mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-09 17:23:18 +08:00
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:
58
packages/stack/example/src/StackWithInput.js
Normal file
58
packages/stack/example/src/StackWithInput.js
Normal 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;
|
||||
Reference in New Issue
Block a user