Skip to content

Commit

Permalink
chore(formatter): execute prettier -- write command to format files
Browse files Browse the repository at this point in the history
  • Loading branch information
IB3N committed Nov 7, 2022
1 parent 7373209 commit 8d84446
Show file tree
Hide file tree
Showing 16 changed files with 1,279 additions and 1,221 deletions.
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ node_modules
ios
android
images

*/.expo
*/node_modules
*/yarn.lock
*/package
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"trailingComma": "all",
"singleQuote": true
}
}
136 changes: 75 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,92 +7,106 @@
## Install

#### 1. Step

```javascript
npm install react-native-insta-story --save
```

or

```javascript
yarn add react-native-insta-story
yarn add react-native-insta-story
```

#### 2. Step

```javascript
cd ios && pod install
```

## Import

```javascript
import InstaStory from 'react-native-insta-story';
```

## Props
| Name | Description | Type | Default Value |
| :--- |:----------------------------------------------------|:----------|:-------------:|
| data | Array of IUserStory. You can check from interfaces. | object | |
| unPressedBorderColor | Unpressed border color of profile circle | color | red |
| pressedBorderColor | Pressed border color of profile circle | color | grey |
| onClose | Todo when close | function | null |
| onStart | Todo when start | function | null |
| duration | Per story duration seconds | number | 10 |
| swipeText | Text of swipe component | string | Swipe Up |

| Name | Description | Type | Default Value |
| :--------------------- | :-------------------------------------------------- | :-------- | :-----------: |
| data | Array of IUserStory. You can check from interfaces. | object | |
| unPressedBorderColor | Unpressed border color of profile circle | color | red |
| pressedBorderColor | Pressed border color of profile circle | color | grey |
| onClose | Todo when close | function | null |
| onStart | Todo when start | function | null |
| duration | Per story duration seconds | number | 10 |
| swipeText | Text of swipe component | string | Swipe Up |
| customSwipeUpComponent | For use custom component for swipe area | component | |
| customCloseComponent | For use custom component for close button | component | |
| avatarSize | Size of avatar circle | number | 60 |
| showAvatarText | For show or hide avatar text. | bool | true |
| textStyle | For avatar text style | TextStyle | |
| customCloseComponent | For use custom component for close button | component | |
| avatarSize | Size of avatar circle | number | 60 |
| showAvatarText | For show or hide avatar text. | bool | true |
| textStyle | For avatar text style | TextStyle | |

## Usage
```javascript

```javascript
const data = [
{
user_id: 1,
user_image: 'https://pbs.twimg.com/profile_images/1222140802475773952/61OmyINj.jpg',
user_name: "Ahmet Çağlar Durmuş",
stories: [
{
story_id: 1,
story_image: "https://image.freepik.com/free-vector/universe-mobile-wallpaper-with-planets_79603-600.jpg",
swipeText:'Custom swipe text for this story',
onPress: () => console.log('story 1 swiped'),
},
{
story_id: 2,
story_image: "https://image.freepik.com/free-vector/mobile-wallpaper-with-fluid-shapes_79603-601.jpg",
}]
},
{
user_id: 2,
user_image: 'https://images.unsplash.com/photo-1511367461989-f85a21fda167?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8cHJvZmlsZXxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&w=1000&q=80',
user_name: "Test User",
stories: [
{
story_id: 1,
story_image: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTjORKvjcbMRGYPR3QIs3MofoWkD4wHzRd_eg&usqp=CAU",
swipeText:'Custom swipe text for this story',
onPress: () => console.log('story 1 swiped'),
},
{
story_id: 2,
story_image: "https://files.oyebesmartest.com/uploads/preview/vivo-u20-mobile-wallpaper-full-hd-(1)qm6qyz9v60.jpg",
swipeText:'Custom swipe text for this story',
onPress: () => console.log('story 2 swiped'),
}]
}];


<InstaStory data={data}
duration={10}
onStart={item => console.log(item)}
onClose={item => console.log('close: ', item)}
customSwipeUpComponent={<View>
<Text>Swipe</Text>
</View>}
style={{marginTop: 30}}/>
{
user_id: 1,
user_image:
'https://pbs.twimg.com/profile_images/1222140802475773952/61OmyINj.jpg',
user_name: 'Ahmet Çağlar Durmuş',
stories: [
{
story_id: 1,
story_image:
'https://image.freepik.com/free-vector/universe-mobile-wallpaper-with-planets_79603-600.jpg',
swipeText: 'Custom swipe text for this story',
onPress: () => console.log('story 1 swiped'),
},
{
story_id: 2,
story_image:
'https://image.freepik.com/free-vector/mobile-wallpaper-with-fluid-shapes_79603-601.jpg',
},
],
},
{
user_id: 2,
user_image:
'https://images.unsplash.com/photo-1511367461989-f85a21fda167?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8cHJvZmlsZXxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&w=1000&q=80',
user_name: 'Test User',
stories: [
{
story_id: 1,
story_image:
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTjORKvjcbMRGYPR3QIs3MofoWkD4wHzRd_eg&usqp=CAU',
swipeText: 'Custom swipe text for this story',
onPress: () => console.log('story 1 swiped'),
},
{
story_id: 2,
story_image:
'https://files.oyebesmartest.com/uploads/preview/vivo-u20-mobile-wallpaper-full-hd-(1)qm6qyz9v60.jpg',
swipeText: 'Custom swipe text for this story',
onPress: () => console.log('story 2 swiped'),
},
],
},
];

<InstaStory
data={data}
duration={10}
onStart={(item) => console.log(item)}
onClose={(item) => console.log('close: ', item)}
customSwipeUpComponent={
<View>
<Text>Swipe</Text>
</View>
}
style={{ marginTop: 30 }}
/>;
```



[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](http://www.bynogame.com/tr/destekle/caglardurmus)
86 changes: 43 additions & 43 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import {StatusBar} from 'expo-status-bar';
import {StyleSheet, Text, View} from 'react-native';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import InstaStory from 'react-native-insta-story';

export default function App() {
function createData() {
const array = []
function createData() {
const array = [];

const userCount = 10;
const userStoryCount = 15;
const userCount = 10;
const userStoryCount = 15;

for (let i = 1; i <= userCount; i++) {
const storyArray = [];
for (let k = 1; k <= userStoryCount; k++) {
storyArray.push(
{
story_id: i,
story_image: "https://picsum.photos/500/800?random=" + Math.random(),
swipeText: 'Custom swipe text for this story',
onPress: () => console.log(`story ${i} swiped`),
}
)
}
for (let i = 1; i <= userCount; i++) {
const storyArray = [];
for (let k = 1; k <= userStoryCount; k++) {
storyArray.push({
story_id: i,
story_image: 'https://picsum.photos/500/800?random=' + Math.random(),
swipeText: 'Custom swipe text for this story',
onPress: () => console.log(`story ${i} swiped`),
});
}

array.push({
user_id: i,
user_image: "https://picsum.photos/200/300?random=" + Math.random(),
user_name: "Test User " + i,
stories: storyArray
})
}
return array;
array.push({
user_id: i,
user_image: 'https://picsum.photos/200/300?random=' + Math.random(),
user_name: 'Test User ' + i,
stories: storyArray,
});
}
return array;
}

return (
<View style={styles.container}>
<StatusBar style="auto"/>
<InstaStory data={createData()}
duration={10}
customSwipeUpComponent={<View>
<Text>Swipe</Text>
</View>}

style={{marginTop: 30}}
/>
</View>
);
return (
<View style={styles.container}>
<StatusBar style="auto" />
<InstaStory
data={createData()}
duration={10}
customSwipeUpComponent={
<View>
<Text>Swipe</Text>
</View>
}
style={{ marginTop: 30 }}
/>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
container: {
flex: 1,
backgroundColor: '#fff',
},
});
4 changes: 1 addition & 3 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
Expand Down
2 changes: 1 addition & 1 deletion example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(api) {
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Story from "./src/Story";
import Story from './src/Story';

export const InstaStory = Story;

Expand Down
Loading

0 comments on commit 8d84446

Please sign in to comment.