prepsmith-react-native-components
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "prepsmith-react-native-components", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"doc": "react-docgen src/components/**/index.js | ./buildDocs.sh", | ||
"lint": "npm run lint:js", | ||
"lint:eslint": | ||
"eslint --ignore-path .gitignore --ignore-pattern internals/scripts", | ||
"lint:js": "npm run lint:eslint -- . ", | ||
"lint:staged": "lint-staged", | ||
"pretest": "npm run test:clean && npm run lint", | ||
"test:clean": "rimraf ./coverage", | ||
"test": "NODE_ENV=test jest --coverage" | ||
}, | ||
"lint-staged": { | ||
"*.js": "lint:eslint" | ||
}, | ||
"pre-commit": "lint:staged", | ||
"repository": { | ||
@@ -23,5 +35,34 @@ "type": "git", | ||
"devDependencies": { | ||
"react": ">=15.0.0", | ||
"react-native": ">=0.24.0" | ||
"babel-eslint": "7", | ||
"babel-preset-react-native": "^4.0.0", | ||
"eslint": "^4.6.1", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-config-standard-react": "^5.0.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-react": "^7.3.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"enzyme": "^3.2.0", | ||
"enzyme-adapter-react-16": "^1.1.0", | ||
"jest": "^21.2.1", | ||
"lint-staged": "^5.0.0", | ||
"pre-commit": "^1.2.2", | ||
"react": ">=16.0.0", | ||
"react-docgen": "^2.20.0", | ||
"react-dom": "^16.2.0", | ||
"react-native": ">=0.24.0", | ||
"react-test-renderer": "^16.1.1", | ||
"rimraf": "^2.6.2", | ||
"sinon": "^4.1.3" | ||
}, | ||
"jest": { | ||
"preset": "react-native", | ||
"setupTestFrameworkScriptFile": "./__tests__/setup.js", | ||
"testRegex": "__tests__/.*\\.test\\.js$", | ||
"unmockedModulePathPatterns": [ | ||
"node_modules/react/", | ||
"node_modules/enzyme/" | ||
] | ||
} | ||
} |
# Prepsmith React Native Components | ||
## Get Start | ||
### Install Dependencies | ||
```bash | ||
npm install -g yarn | ||
yarn install | ||
``` | ||
### Generate Documentation | ||
```bash | ||
yarn run doc | ||
``` | ||
Then check `DOC.md` | ||
### Test | ||
```bash | ||
yarn test | ||
``` | ||
### Lint | ||
```bash | ||
yarn run lint | ||
``` | ||
## Example | ||
For `AnswerSelectionPicker` component. | ||
```jsx | ||
@@ -6,0 +37,0 @@ <AnswerSelectionPicker |
@@ -15,9 +15,6 @@ import React, { Component } from 'react' | ||
static defaultProps = { | ||
onSelect: function({ isRight }) { | ||
return false | ||
}, | ||
rightAnswerStyle: { backgroundColor: 'rgba(0, 255, 0, 0.3)' }, | ||
wrongAnswerStyle: { backgroundColor: 'rgba(255, 0, 0, 0.3)' }, | ||
selected: null, | ||
onSelect: function({ index, correct }) { | ||
onSelect: function ({ index, correct }) { | ||
return false | ||
@@ -27,3 +24,3 @@ } | ||
constructor(props) { | ||
constructor (props) { | ||
super(props) | ||
@@ -35,3 +32,3 @@ | ||
_getStyle({ answer, index }) { | ||
_getStyle ({ answer, index }) { | ||
if (this.props.selected !== null && answer.isRight) { | ||
@@ -48,15 +45,6 @@ return this.props.rightAnswerStyle | ||
_ListAnswers({ answer, index }) { | ||
let percentage = Math.random() | ||
_ListAnswers ({ answer, index }) { | ||
return ( | ||
<TouchableOpacity | ||
key={index} | ||
style={[ | ||
{ | ||
padding: 15, | ||
marginBottom: 1, | ||
flexDirection: 'column' | ||
}, | ||
this._getStyle({ answer, index }) | ||
]} | ||
onPress={() => { | ||
@@ -66,3 +54,13 @@ this.props.onSelect({ index, isCorrect: answer.isRight }) | ||
> | ||
<Text>{answer.text}</Text> | ||
<Text | ||
style={[ | ||
{ | ||
padding: 15, | ||
marginBottom: 1 | ||
}, | ||
this._getStyle({ answer, index }) | ||
]} | ||
> | ||
{answer.text} | ||
</Text> | ||
</TouchableOpacity> | ||
@@ -72,3 +70,3 @@ ) | ||
render() { | ||
render () { | ||
return ( | ||
@@ -75,0 +73,0 @@ <View> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 96 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
202584
186
732
2
46
22
97