Skip to content

Commit f0dded1

Browse files
RayKay91RayKay91
authored andcommitted
chore: add instructions in readme
1 parent 8085b51 commit f0dded1

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,35 @@ npm install react-native-easter-egg
1010

1111
## Usage
1212

13-
```js
14-
import { multiply } from 'react-native-easter-egg';
15-
16-
// ...
17-
18-
const result = await multiply(3, 7);
13+
Import the `<EasterEgg />` component and wrap your component with it. It will allow it to move along the vertical and horizontal planes. It accepts a number of props which will allow you to customise it to your needs.
14+
15+
| Prop | Default | Description |
16+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17+
| onCodeInputSuccess | N/A | A function that will be executed when the user inputs match the secret code. **REQUIRED** |
18+
| onCodeInputFailure | N/A | A function that will be executed when the user inputs match the length of the secret code, but don't match the code exactly. |
19+
| onGestureStart | N/A | A function that will be executed when the pan gesture starts. |
20+
| onGestureUpdate | N/A | A function that will be executed as the pan gesture updates on finger movement. |
21+
| onGestureEnd | N/A | A function that will be executed when the user lifts their finger from the screen. |
22+
| inputThreshold | 20 | The max number of pixels the user can move the component. Beyond this point moving the finger won't move the component. |
23+
| onInputThresholdReached | N/A | A function that will be executed everytime the pan gesture continues after reaching the `inputThreshold` |
24+
| dragResistance | 4 | Determines how difficult it feels to move the content in a direction. The higher the number the more difficult it will feel. |
25+
| resetTimer | 20000 | The time in ms that it will take to reset the user inputs. After the timeout the user can enter the gestures again. Or they can unmount and remount the component by navigating away or something. |
26+
| secretCode | [ Directions.UP, Directions.UP, Directions.DOWN, Directions.DOWN, Directions.LEFT, Directions.RIGHT, Directions.LEFT, Directions.RIGHT, ] | The secret code that the user must match with their inputs. Defaults to the Konami code. You can import the `Directions` enum and create your own custom array of directions for a more personalised secret code. |
27+
28+
Since this package relies on react-native-gesture-handler and react-native-reanimated please see the installation instructions for those if you're getting errors. The gesture handler for example requires that the app be wrapped in a `<GestureHandlerRootView />`.
29+
30+
```tsx
31+
import { EasterEgg } from 'react-native-easter-egg';
32+
33+
function App() {
34+
return (
35+
<EasterEgg onCodeInputSuccess={() => Alert.alert('Hello')}>
36+
<YourComponent />
37+
</EasterEgg>
38+
);
39+
}
1940
```
2041

21-
## Contributing
22-
23-
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
24-
2542
## License
2643

2744
MIT

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-easter-egg",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "test",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)