Skip to content

Commit

Permalink
feat: 使用bob
Browse files Browse the repository at this point in the history
  • Loading branch information
wiseqingyang committed Feb 27, 2023
1 parent a7077e8 commit 0746500
Show file tree
Hide file tree
Showing 12 changed files with 21,226 additions and 273 deletions.
133 changes: 0 additions & 133 deletions CODE_OF_CONDUCT.md

This file was deleted.

116 changes: 0 additions & 116 deletions CONTRIBUTING.md

This file was deleted.

14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@ npm install react-native-draggable-floating
## Usage

```js
import { multiply } from 'react-native-draggable-floating';
import DraggableView from 'react-native-draggable-floating';

// ...

const result = await multiply(3, 7);
<DraggableView>
<View />
</DraggableView>
```

## Contributing
## Props

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

Prop | Type | Default | Description
--- | --- | --- | ---
`stickyLeft` | `boolean` | `false` | Whether to stick to the left side of its parent.
`initialOffsetY` | `number` | 0 | The initial offset of the widget from the top of its parent. If negative, the offset will be the bottom.

## License

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin'],
};
1 change: 1 addition & 0 deletions example/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function (api) {
},
},
],
'react-native-reanimated/plugin',
],
};
};
13 changes: 6 additions & 7 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
"ios": "expo start --ios"
},
"dependencies": {
"expo": "~48.0.4",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-native": "0.71.3",
"react-dom": "18.2.0",
"react-native-web": "~0.18.10"
"react-native-gesture-handler": "^2.9.0",
"react-native-reanimated": "^2.14.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"babel-plugin-module-resolver": "^4.1.0",
"@expo/webpack-config": "^0.17.2",
"babel-loader": "^8.1.0"
"babel-loader": "^8.1.0",
"babel-plugin-module-resolver": "^4.1.0"
},
"private": true
}
}
56 changes: 46 additions & 10 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
import * as React from 'react';

import { StyleSheet, View, Text } from 'react-native';
import { multiply } from 'react-native-draggable-floating';
import { StyleSheet, View, Text, Pressable, Switch } from 'react-native';
import DraggableView from 'react-native-draggable-floating';

export default function App() {
const [result, setResult] = React.useState<number | undefined>();

React.useEffect(() => {
multiply(3, 7).then(setResult);
}, []);
const [stickyLeft, setStickyLeft] = React.useState(true);
const [negative, setNegative] = React.useState(false);

const offsetY = 50;
return (
<View style={styles.container}>
<Text>Result: {result}</Text>
<View style={styles.cellContainer}>
<Text>props</Text>
<Text>value</Text>
</View>
<View style={styles.cellContainer}>
<Text>stickyLeft</Text>
<Switch
value={stickyLeft}
onChange={(e) => setStickyLeft(e.nativeEvent.value)}
/>
</View>
<View style={styles.cellContainer}>
<Text>offsetY: {negative ? -offsetY : offsetY}</Text>
<Switch
value={negative}
onChange={(e) => setNegative(e.nativeEvent.value)}
/>
</View>
<DraggableView
stickyLeft={stickyLeft}
initialOffsetY={negative ? -offsetY : offsetY}
>
<Pressable style={styles.floatBtn}>
<Text>Debug</Text>
</Pressable>
</DraggableView>
</View>
);
}
Expand All @@ -23,9 +46,22 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},
box: {
cellContainer: {
alignSelf: 'stretch',
paddingVertical: 4,
marginHorizontal: 15,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
borderColor: '#998877',
borderBottomWidth: 1,
},
floatBtn: {
width: 60,
height: 60,
marginVertical: 20,
borderRadius: 30,
backgroundColor: '#ff4444',
alignItems: 'center',
justifyContent: 'center',
},
});
Loading

0 comments on commit 0746500

Please sign in to comment.