react-native-instagram-story
v1.0.0
Published
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
Downloads
15
Readme
Getting Started
React Native Instagram Story
A React Native component that mimics the Instagram Stories feature. Users can tap to navigate to the previous or next story and hold to stop the story from progressing automatically.
Features
Swipe left/right to navigate through stories. Tap left to go to the previous story. Tap right to go to the next story. Long press to pause the story.
Installation
To install the package, run:
npm install react-native-instagram-story
or For yarn
yarn add react-native-instagram-story
Usage
Here’s an example of how to use the react-native-instagram-story component in your React Native project.
import React from 'react';
import { StyleSheet, View,TouchableOpacity,Modal } from 'react-native';
import StoryFeature from 'react-native-instagram-story';
const App = () => {
const data = [
{
type: 'image',
image: 'https://picsum.photos/seed/picsum/200/300',
description: "The placeholder text, beginning with the line “Lorem ipsum dolor sit amet, consectetur adipiscing elit”, looks like Latin because in its youth, centuries ago, it was Latin."
},
{
type: 'image',
image: 'https://fastly.picsum.photos/id/57/2448/3264.jpg?hmac=ewraXYesC6HuSEAJsg3Q80bXd1GyJTxekI05Xt9YjfQ',
description: "McClintock's eye for detail certainly helped narrow the whereabouts of lorem ipsum's origin, however, the “how and when” still remain something of a mystery, with competing theories and timelines."
},
{
type: 'image',
image: 'https://fastly.picsum.photos/id/13/2500/1667.jpg?hmac=SoX9UoHhN8HyklRA4A3vcCWJMVtiBXUg0W4ljWTor7s',
description: "As an alternative theory, (and because Latin scholars do this sort of thing) someone tracked down a 1914 Latin edition of De Finibus which challenges McClintock's 15th century claims "
},
{
type: 'image',
image: 'https://fastly.picsum.photos/id/28/4928/3264.jpg?hmac=GnYF-RnBUg44PFfU5pcw_Qs0ReOyStdnZ8MtQWJqTfA',
description: "The decade that brought us Star Trek and Doctor Who also resurrected Cicero—or at least what used to be Cicero"
},
];
return (
<View style={styles.main}>
<Modal
transparent={true}
animationType="slide"
visible={isModalVisible}
onRequestClose={closeModal}
>
<View style={styles.container}>
<View style={styles.walkthroughModalContent}>
<StoryFeature
closeModal={closeModal}
stories={data}
/>
</View>
</View>
</Modal>
<TouchableOpacity style={styles.button} onPress={openModal}>
<Text style={styles.buttonTextt}>Open Story Crousal</Text>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
walkthroughModalContent: {
backgroundColor: '#ffffff',
height,
paddingTop: 25,
shadowColor: "#000",
shadowOffset: { width: 1, height: 1 },
shadowOpacity: 0.3,
shadowRadius: 5,
elevation: 5,
// paddingBottom: 50
},
container: {
flex: 1,
backgroundColor: "rgba(0,0,0,0.2)",
justifyContent: "flex-end",
},
button: {
borderWidth: 1,
padding: 15,
backgroundColor: "#063970",
borderRadius: 10,
borderColor: "grey"
},
buttonTextt: {
color: "#fff",
fontWeight: "700"
},
main: {
justifyContent: "center",
alignItems: "center",
flex: 1
}
})
export default App;
Let's Connect
Anurag Sharma
I am always excited to connect with like-minded professionals and explore new opportunities. Feel free to reach out to me on LinkedIn or check out my portfolio on GitHub.