Reputation: 482
I'm trying to implement my code day by day by updating myself to right solution.. In below code I want to implement onPress button Screen redirection on same window with scrollview as it mention in code, there is a Two Screen A and Screen B, and above there is Two buttons when I click on any of the button at that time I want action to scroll to that screen..
how can I do this using Scroll Into View Library
here is perfectly shown how I really want to make it..
App.js
import React, { useState } from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import {
Dimensions,
RefreshControl,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import Button from '../custom-components/Button'
const App = ({ navigation }) => {
return (
<View>
<View style={{ alignItems: "center" }}>
<View style={{ flexDirection: "row" }}>
<Button
title="ScreenA"
stylebtn={styles.btns}
stylebtntitle={styles.btnsTxt}
onPress={screenA}
/>
<Button
title="ScreenB"
stylebtn={styles.btns}
stylebtntitle={styles.btnsTxt}
onPress={ScreenB}
/>
</View>
</View>
<ScrollView>
<ScreenA style={styles.screen}/>
<ScreenB style={styles.screen}/>
</ScrollView>
</View>
);
};
const styles = StyleSheet.create({
screen: {
backgroundColor: 'yellow',
flexDirection: 'column',
justifyContent: 'center'
},
});
export default App;
Upvotes: 1
Views: 92