refactor: don't use keyboardAwareNavigator The HOC currently forces us to expose some options in stack config which we don't want to. So we vendor this functionality for now to avoid this.

This commit is contained in:
satyajit.happy
2019-07-14 21:55:19 +02:00
parent cfa7e2f1a1
commit 4db67a17a6
10 changed files with 170 additions and 72 deletions

View File

@@ -0,0 +1,58 @@
import * as React from 'react';
import { Button, TextInput, View } from 'react-native';
import {
createStackNavigator,
TransitionPresets,
} from 'react-navigation-stack';
class Input extends React.Component {
static navigationOptions = {
title: 'Input screen',
};
render() {
return (
<TextInput
placeholder="Type something"
style={{
backgroundColor: 'white',
paddingVertical: 12,
paddingHorizontal: 16,
margin: 24,
}}
/>
);
}
}
class Home extends React.Component {
static navigationOptions = {
title: 'Home',
};
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button
onPress={() => this.props.navigation.push('Input')}
title="Push screen with input"
/>
</View>
);
}
}
const App = createStackNavigator(
{
Home: { screen: Home },
Input: { screen: Input },
},
{
defaultNavigationOptions: {
...TransitionPresets.SlideFromRightIOS,
gesturesEnabled: true,
},
}
);
export default App;