-
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: add support for ordering stories, move to next when video ends
- Loading branch information
1 parent
0d2d65f
commit fc9fd6f
Showing
6 changed files
with
153 additions
and
62 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
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 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 |
---|---|---|
@@ -1,49 +1,51 @@ | ||
import React from 'react'; | ||
import { Avatar } from 'react-native-elements'; | ||
import { ActivityIndicator } from 'react-native'; | ||
import { ActivityIndicator, ViewStyle } from 'react-native'; | ||
|
||
import { styles } from './styles'; | ||
|
||
export type StoryPreviewItemProps = { | ||
onPress: any; | ||
/** | ||
* URL of the avatar | ||
*/ | ||
preview: string; | ||
viewed: boolean; | ||
}; | ||
|
||
// TODO: extract to props | ||
const colors = { | ||
primary: '#5D8FDB', | ||
lightPrimary: 'rgb(233,240,251)', | ||
secondary: '#5E5E5E', | ||
storyBorder: '#D3D3D3', | ||
lightSecondary: 'rgb(211,211,211)', | ||
white: 'rgb(255,255,255)', | ||
black: 'rgb(0,0,0)', | ||
facebook: '#3b5998', | ||
red: 'red', | ||
/** | ||
* The onPress handler | ||
*/ | ||
onPress: () => void; | ||
/** | ||
* The styles to be applied to the container | ||
*/ | ||
containerStyle?: ViewStyle; | ||
/** | ||
* The styles to be applied to the placeholder | ||
*/ | ||
placeholderStyle?: ViewStyle; | ||
/** | ||
* The size of the Avatar component | ||
*/ | ||
size?: 'small' | 'medium' | 'large' | 'xlarge' | number; | ||
}; | ||
|
||
export const StoryPreviewItem: React.FC<StoryPreviewItemProps> = ({ | ||
viewed, | ||
size, | ||
onPress, | ||
preview, | ||
}) => { | ||
return ( | ||
<Avatar | ||
size="medium" | ||
source={{ | ||
uri: preview, | ||
}} | ||
containerStyle={{ | ||
...styles.container, | ||
borderColor: viewed ? colors.storyBorder : colors.red, | ||
}} | ||
onPress={() => onPress && onPress()} | ||
renderPlaceholderContent={<ActivityIndicator color={colors.white} />} | ||
placeholderStyle={styles.placeholder} | ||
rounded | ||
/> | ||
); | ||
}; | ||
preview: uri, | ||
containerStyle, | ||
placeholderStyle, | ||
}) => ( | ||
<Avatar | ||
rounded | ||
size={size} | ||
source={{ uri }} | ||
onPress={() => onPress()} | ||
placeholderStyle={placeholderStyle} | ||
containerStyle={[styles.container, containerStyle]} | ||
renderPlaceholderContent={<ActivityIndicator color="#FFFFFF" />} | ||
/> | ||
); | ||
|
||
StoryPreviewItem.displayName = 'StoryPreviewItem'; | ||
StoryPreviewItem.defaultProps = { | ||
size: 'medium', | ||
}; |
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 |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
// TODO: extract to props | ||
const colors = { | ||
primary: '#5D8FDB', | ||
lightPrimary: 'rgb(233,240,251)', | ||
secondary: '#5E5E5E', | ||
storyBorder: '#D3D3D3', | ||
lightSecondary: 'rgb(211,211,211)', | ||
white: 'rgb(255,255,255)', | ||
black: 'rgb(0,0,0)', | ||
facebook: '#3b5998', | ||
red: 'red', | ||
}; | ||
|
||
export const styles = StyleSheet.create({ | ||
container: { | ||
marginHorizontal: 10, | ||
marginBottom: 18, | ||
borderWidth: 1, | ||
}, | ||
placeholder: { | ||
backgroundColor: colors.primary, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
export * from './components/StoryPreview'; | ||
|
||
// TODO: add support for passing a loading component to the StoryDetailItem | ||
// TODO: add support for improving the loading performance of react-native-video |