Skip to content

Instantly share code, notes, and snippets.

@nitaliano nitaliano/App.js
Created Sep 19, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.