Releases: Qeepsake/react-native-subset-navigator
Releases · Qeepsake/react-native-subset-navigator
1.2.0 Able to pass props to individual screens
Can now pass props to the next screen/ component with the push
method and access it with the passProps
prop:
const OnboardingOne = ({ navigator, passProps }) => {
return (
<>
<TouchableOpacity onPress={() => {
navigator.push("OnboardingTwo", {
setPageNumber: passProps.setPageNumber,
})}
}>
</TouchableOpacity>
</>
);
}
1.1.0 Added animations hooks for transitions between screens
It can be used as shown:
import { Animated, ... } from 'react-native' //<-- import Animated from react-native
import {
useFadeInAnimation,
useSlideRightAnimation,
} from 'react-native-subset-navigator' //<-- import the animations you want
const OnboardingOne = ({ navigator, passProps }) => {
// Use animations like so
const animatedOpacity = useFadeInAnimation()
const slideRightAnimation = useSlideRightAnimation()
return (
// Use Animated
<Animated.View style={[animatedOpacity, slideRightAnimation]}>
<TouchableOpacity onPress={() => navigator.push("OnboardingTwo")}>
<View />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigator.pop()}>
<View />
</TouchableOpacity>
<TouchableOpacity onPress={() => passProps.setPageNumber(2)}>
<View />
</TouchableOpacity>
</Animated.View>
);
}
1.0.4 Allow passing of props to screens
1.0.3 Export Navigator class
- Export Navigator class 6234313
1.0.2 Updated react version
1.0.1 Added tsconfig.json
- Added tsconfig.json b3f416b
1.0.0 Initial Commit
Usage:
- Create the Subset Navigator
createSubsetNavigator(nameOfFirstOverlay, Overlays)
import { createSubsetNavigator } from "react-native-subset-navigator";
const OnboardingOverlay = () => {
const OverlaySubset = createSubsetNavigator("OnboardingOne", {
"OnboardingOne": OnboardingOne,
"OnboardingTwo": OnboardingTwo,
"OnboardingThree": OnboardingThree,
})
return (
<View style={{}}> // <-- modal common container
<OverlaySubset />
</View>
);
}
- Create the components to take in a 'navigator' prop and use the push and pop methods to navigate
const OnboardingOne = ({ navigator }) => {
return (
<>
<TouchableOpacity onPress={() => navigator.push("OnboardingTwo")}>
<View />
<TouchableOpacity>
<TouchableOpacity onPress={() => navigator.pop()}>
<View />
<TouchableOpacity>
</>
);
}