-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to use some custom components
- Loading branch information
1 parent
2cdd8a5
commit 59ae346
Showing
16 changed files
with
368 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import { StatusBar } from 'expo-status-bar'; | ||
import { faker } from '@faker-js/faker'; | ||
|
||
import Story from 'react-native-story-component'; | ||
|
||
const createStories = () => { | ||
const USER_COUNT = 5; | ||
const USER_STORY_COUNT = 3; | ||
|
||
return [...Array(USER_COUNT).keys()].map((i) => ({ | ||
id: `user-${i}`, | ||
avatar: faker.image.avatar(), | ||
name: faker.name.findName(), | ||
// seen: Math.random() < 0.5, | ||
stories: [...Array(USER_STORY_COUNT).keys()].map((y) => ({ | ||
id: `story-${i}-${y}`, | ||
image: faker.image.imageUrl(1080, 1920, undefined, true), | ||
swipeText: faker.lorem.text(), | ||
onPress: () => console.log(`Story ${i}-${y} swiped!`), | ||
})), | ||
})); | ||
}; | ||
|
||
const App = () => { | ||
return ( | ||
<> | ||
<StatusBar backgroundColor="#000" style="light" /> | ||
<View style={styles.container}> | ||
<Story | ||
data={createStories()} | ||
duration={10} | ||
// customStoryView={({ index }) => { | ||
// return ( | ||
// <View | ||
// key={index} | ||
// style={{ | ||
// backgroundColor: '#fff', | ||
// }} | ||
// > | ||
// <Text>Custom View</Text> | ||
// </View> | ||
// ); | ||
// }} | ||
customSwipeUpButton={() => ( | ||
<View> | ||
<Text>Swipe</Text> | ||
</View> | ||
)} | ||
storyListStyle={styles.story} | ||
/> | ||
</View> | ||
</> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#fff', | ||
}, | ||
story: { | ||
marginTop: 70, | ||
}, | ||
}); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.