Skip to content

Instantly share code, notes, and snippets.

@nitaliano
Created September 19, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitaliano/948a366d4bf902c4a89a6a1e39b8e5d5 to your computer and use it in GitHub Desktop.
Save nitaliano/948a366d4bf902c4a89a6a1e39b8e5d5 to your computer and use it in GitHub Desktop.
Example Text Input
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Fragment} from 'react';
import {
SafeAreaView,
StyleSheet,
View,
Text,
StatusBar,
requireNativeComponent,
Platform,
TextInput
} from 'react-native';
const NativeTextInput = Platform.OS === 'ios' : requireNativeComponent('ExampleTextInput') : TextInput;
const App = () => {
return (
<Fragment>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={styles.container}>
<View style={styles.container}>
<NativeTextInput style={styles.input} />
</View>
</SafeAreaView>
</Fragment>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
input: {
width: 200,
height: 60,
borderColor: 'blue',
borderWidth: 1,
}
});
export default App;
#import <React/RCTSinglelineTextInputViewManager.h>
@interface ExampleTextInputManager : RCTSinglelineTextInputViewManager
@end
#import "ExampleTextInputManager.h"
@implementation ExampleTextInputManager
RCT_EXPORT_MODULE()
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment