├── .eslintrc ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── index.js ├── package.json └── src └── SaneListView.js /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "env": { 4 | "es6": true, 5 | "node": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 7, 9 | "sourceType": "module", 10 | "ecmaFeatures": { 11 | "impliedStrict": true, 12 | "jsx": true, 13 | "experimentalObjectRestSpread": true 14 | } 15 | }, 16 | "plugins": [ 17 | "react", 18 | "react-native", 19 | "babel" 20 | ], 21 | "rules": { 22 | /* 23 | * possible errors 24 | */ 25 | "comma-dangle": "error", 26 | "no-cond-assign": [ 27 | "error", 28 | "except-parens" 29 | ], 30 | "no-console": "warn", 31 | "no-constant-condition": "error", 32 | "no-control-regex": "error", 33 | "no-debugger": "warn", 34 | "no-dupe-args": "error", 35 | "no-dupe-keys": "error", 36 | "no-duplicate-case": "error", 37 | "no-empty": "error", 38 | "no-empty-character-class": "error", 39 | "no-ex-assign": "error", 40 | "no-extra-boolean-cast": "error", 41 | "no-extra-parens": 0, 42 | "no-extra-semi": "error", 43 | "no-func-assign": "error", 44 | "no-inner-declarations": "error", 45 | "no-invalid-regexp": "error", 46 | "no-irregular-whitespace": "error", 47 | "no-negated-in-lhs": "error", 48 | "no-obj-calls": "error", 49 | "no-regex-spaces": "error", 50 | "no-sparse-arrays": "error", 51 | "no-unexpected-multiline": "error", 52 | "no-unreachable": "error", 53 | "use-isnan": "error", 54 | "valid-jsdoc": 0, 55 | "valid-typeof": "error", 56 | /* 57 | * best practices 58 | */ 59 | "accessor-pairs": "warn", 60 | "array-callback-return": 0, 61 | "block-scoped-var": "error", 62 | "complexity": 0, 63 | "consistent-return": "error", 64 | "curly": [ 65 | "error", 66 | "all" 67 | ], 68 | "default-case": "error", 69 | "dot-location": [ 70 | "error", 71 | "property" 72 | ], 73 | "dot-notation": "error", 74 | "eqeqeq": "error", 75 | "guard-for-in": "error", 76 | "no-alert": "error", 77 | "no-caller": "error", 78 | "no-case-declarations": "error", 79 | "no-div-regex": 0, 80 | "no-else-return": 0, 81 | "no-empty-function": "error", 82 | "no-empty-pattern": "error", 83 | "no-eq-null": "error", 84 | "no-eval": "error", 85 | "no-extend-native": "error", 86 | "no-extra-bind": "error", 87 | "no-extra-label": "error", 88 | "no-fallthrough": "error", 89 | "no-floating-decimal": "error", 90 | "no-implicit-coercion": "error", 91 | "no-implicit-globals": 0, 92 | "no-implied-eval": "error", 93 | "no-invalid-this": 0, 94 | "no-iterator": "error", 95 | "no-labels": "error", 96 | "no-lone-blocks": "error", 97 | "no-loop-func": "error", 98 | "no-magic-numbers": 0, 99 | "no-multi-spaces": "error", 100 | "no-multi-str": 0, 101 | "no-native-reassign": "error", 102 | "no-new": "error", 103 | "no-new-func": "error", 104 | "no-new-wrappers": "error", 105 | "no-octal": "error", 106 | "no-octal-escape": "error", 107 | "no-param-reassign": "error", 108 | "no-proto": "error", 109 | "no-redeclare": 0, 110 | "no-return-assign": "error", 111 | "no-script-url": "error", 112 | "no-self-assign": "error", 113 | "no-self-compare": "error", 114 | "no-sequences": "error", 115 | "no-throw-literal": "error", 116 | "no-unmodified-loop-condition": 0, 117 | "no-unused-expressions": "error", 118 | "no-unused-labels": 0, 119 | "no-useless-call": "error", 120 | "no-useless-concat": "error", 121 | "no-void": "error", 122 | "no-warning-comments": 0, 123 | "no-with": "error", 124 | "radix": 0, 125 | "vars-on-top": 0, 126 | "wrap-iife": "error", 127 | "yoda": 0, 128 | "strict": [ 129 | "error", 130 | "never" 131 | ], 132 | /* 133 | * variables 134 | */ 135 | "init-declarations": 0, 136 | "no-catch-shadow": "error", 137 | "no-delete-var": "error", 138 | "no-label-var": "error", 139 | "no-restricted-globals": "error", 140 | "no-shadow": "error", 141 | "no-shadow-restricted-names": "error", 142 | "no-undef": 0, 143 | "no-undef-init": "error", 144 | "no-undefined": 0, 145 | "no-unused-vars": 0, 146 | "no-use-before-define": 0, 147 | /* 148 | * Node.js 149 | */ 150 | "callback-return": 0, 151 | "global-require": 0, 152 | "handle-callback-err": 0, 153 | "no-mixed-requires": "error", 154 | "no-new-require": "error", 155 | "no-path-concat": "error", 156 | "no-process-env": 0, 157 | "no-process-exit": "error", 158 | "no-restricted-modules": 0, 159 | "no-sync": 0, 160 | /* 161 | * style 162 | */ 163 | "array-bracket-spacing": [ 164 | "error", 165 | "never" 166 | ], 167 | "block-spacing": "error", 168 | "brace-style": [ 169 | "error", 170 | "1tbs" 171 | ], 172 | "camelcase": [ 173 | "error", 174 | { 175 | "properties": "never" 176 | } 177 | ], 178 | "comma-spacing": [ 179 | "error", 180 | { 181 | "before": false, 182 | "after": true 183 | } 184 | ], 185 | "comma-style": [ 186 | "error", 187 | "last" 188 | ], 189 | "computed-property-spacing": [ 190 | "error", 191 | "never" 192 | ], 193 | "consistent-this": [ 194 | "error", 195 | "self" 196 | ], 197 | "eol-last": [ 198 | "error", 199 | "unix" 200 | ], 201 | "func-names": 0, 202 | "func-style": 0, 203 | "id-blacklist": 0, 204 | "id-length": 0, 205 | "id-match": 0, 206 | "indent": [ 207 | "error", 208 | 2, 209 | { 210 | "SwitchCase": 1 211 | } 212 | ], 213 | "jsx-quotes": "error", 214 | "key-spacing": [ 215 | "error", 216 | { 217 | "singleLine": { 218 | "beforeColon": false, 219 | "afterColon": true, 220 | "mode": "strict" 221 | }, 222 | "multiLine": { 223 | "beforeColon": false, 224 | "afterColon": true, 225 | "mode": "strict" 226 | } 227 | } 228 | ], 229 | "keyword-spacing": [ 230 | "error", 231 | { 232 | "before": true, 233 | "after": true 234 | } 235 | ], 236 | "linebreak-style": [ 237 | "error", 238 | "unix" 239 | ], 240 | "lines-around-comment": 0, 241 | "max-depth": [ 242 | "error", 243 | 4 244 | ], 245 | "max-len": [ 246 | "warn", 247 | 150 248 | ], 249 | "max-nested-callbacks": [ 250 | "error", 251 | 4 252 | ], 253 | "max-params": [ 254 | "error", 255 | 6 256 | ], 257 | "max-statements": [ 258 | "error", 259 | 15, 260 | { 261 | "ignoreTopLevelFunctions": true 262 | } 263 | ], 264 | "new-cap": [ 265 | "error", 266 | { 267 | "capIsNewExceptions": [ 268 | "Immutable" 269 | ] 270 | } 271 | ], 272 | "new-parens": "error", 273 | "newline-after-var": 0, 274 | "newline-before-return": 0, 275 | "newline-per-chained-call": 0, 276 | "no-array-constructor": "error", 277 | "no-bitwise": 0, 278 | "no-continue": 0, 279 | "no-inline-comments": 0, 280 | "no-lonely-if": "error", 281 | "no-mixed-spaces-and-tabs": 0, 282 | "no-multiple-empty-lines": [ 283 | "error", 284 | { 285 | "max": 1 286 | } 287 | ], 288 | "no-negated-condition": 0, 289 | "no-nested-ternary": "error", 290 | "no-new-object": "error", 291 | "no-plusplus": 0, 292 | "no-restricted-syntax": 0, 293 | "no-spaced-func": "error", 294 | "no-ternary": 0, 295 | "no-trailing-spaces": [ 296 | "error", 297 | { 298 | "skipBlankLines": true 299 | } 300 | ], 301 | "no-underscore-dangle": 0, 302 | "no-unneeded-ternary": "error", 303 | "no-whitespace-before-property": "error", 304 | "object-curly-spacing": [ 305 | "error", 306 | "never" 307 | ], 308 | "one-var": 0, 309 | "one-var-declaration-per-line": 0, 310 | "operator-assignment": 0, 311 | "operator-linebreak": [ 312 | "error", 313 | "after" 314 | ], 315 | "padded-blocks": [ 316 | "error", 317 | "never" 318 | ], 319 | "quote-props": [ 320 | "error", 321 | "consistent-as-needed" 322 | ], 323 | "quotes": 0, 324 | "require-jsdoc": 0, 325 | "semi": [ 326 | "error", 327 | "always" 328 | ], 329 | "semi-spacing": [ 330 | "error", 331 | { 332 | "before": false, 333 | "after": true 334 | } 335 | ], 336 | "sort-imports": 0, 337 | "sort-vars": 0, 338 | "space-before-blocks": [ 339 | "error", 340 | "always" 341 | ], 342 | "space-before-function-paren": [ 343 | "error", 344 | "never" 345 | ], 346 | "space-in-parens": [ 347 | "error", 348 | "never" 349 | ], 350 | "space-infix-ops": "error", 351 | "space-unary-ops": "error", 352 | "spaced-comment": 0, 353 | "wrap-regex": "error", 354 | /* 355 | * ECMAScript 6 356 | */ 357 | "arrow-body-style": 0, 358 | "arrow-parens": 0, 359 | "arrow-spacing": [ 360 | "error", 361 | { 362 | "before": true, 363 | "after": true 364 | } 365 | ], 366 | "constructor-super": "error", 367 | "generator-star-spacing": 0, 368 | "no-class-assign": "error", 369 | "no-confusing-arrow": "error", 370 | "no-const-assign": "error", 371 | "no-dupe-class-members": "error", 372 | "no-new-symbol": "error", 373 | "no-restricted-imports": 0, 374 | "no-this-before-super": "error", 375 | "no-useless-constructor": 0, 376 | "no-var": "error", 377 | "object-shorthand": 0, 378 | "prefer-arrow-callback": 0, 379 | "prefer-const": "error", 380 | "prefer-reflect": 0, 381 | "prefer-rest-params": "error", 382 | "prefer-spread": "error", 383 | "prefer-template": 0, 384 | "require-yield": 0, 385 | "template-curly-spacing": [ 386 | "error", 387 | "never" 388 | ], 389 | "yield-star-spacing": [ 390 | "error", 391 | "after" 392 | ], 393 | /* 394 | * react plugin 395 | */ 396 | "react/display-name": 0, 397 | "react/forbid-prop-types": [ 398 | "error", 399 | { 400 | "forbid": [ 401 | "any" 402 | ] 403 | } 404 | ], 405 | "react/no-danger": "error", 406 | "react/no-deprecated": "error", 407 | "react/no-did-mount-set-state": [ 408 | "error", 409 | "allow-in-func" 410 | ], 411 | "react/no-did-update-set-state": [ 412 | "error", 413 | "allow-in-func" 414 | ], 415 | "react/no-direct-mutation-state": "error", 416 | "react/no-is-mounted": "error", 417 | "react/no-multi-comp": "error", 418 | "react/no-set-state": 0, 419 | "react/no-string-refs": 0, 420 | "react/no-unknown-property": 0, 421 | "react/prefer-es6-class": [ 422 | "error", 423 | "always" 424 | ], 425 | "react/prefer-stateless-function": 0, 426 | "react/prop-types": 0, 427 | "react/react-in-jsx-scope": "error", 428 | "react/require-extension": 0, 429 | "react/self-closing-comp": "error", 430 | "react/sort-comp": [ 431 | "error", 432 | { 433 | "order": [ 434 | "static-methods", 435 | "lifecycle", 436 | "/^on.+$/", 437 | "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/", 438 | "everything-else", 439 | "/^render.+$/", 440 | "render" 441 | ] 442 | } 443 | ], 444 | "react/sort-prop-types": 0, 445 | "react/wrap-multilines": "error", 446 | "react/jsx-boolean-value": [ 447 | "error", 448 | "always" 449 | ], 450 | "react/jsx-closing-bracket-location": "error", 451 | "react/jsx-curly-spacing": [ 452 | "error", 453 | "never" 454 | ], 455 | "react/jsx-equals-spacing": [ 456 | "error", 457 | "never" 458 | ], 459 | "react/jsx-handler-names": [ 460 | "error", 461 | { 462 | "eventHandlerPropPrefix": "handle" 463 | } 464 | ], 465 | "react/jsx-indent-props": [ 466 | 0, 467 | 2 468 | ], 469 | "react/jsx-indent": [ 470 | "error", 471 | 2 472 | ], 473 | "react/jsx-key": "error", 474 | "react/jsx-max-props-per-line": [ 475 | "error", 476 | { 477 | "maximum": 2 478 | } 479 | ], 480 | "react/jsx-no-bind": 0, 481 | "react/jsx-no-duplicate-props": [ 482 | "error", 483 | { 484 | "ignoreCase": true 485 | } 486 | ], 487 | "react/jsx-no-literals": "error", 488 | "react/jsx-no-undef": "error", 489 | "react/jsx-pascal-case": "error", 490 | "react/jsx-sort-props": 0, 491 | "react/jsx-space-before-closing": 0, 492 | "react/jsx-uses-react": "error", 493 | "react/jsx-uses-vars": "error", 494 | /* 495 | * react-native plugin 496 | */ 497 | "react-native/no-unused-styles": "error", 498 | "react-native/split-platform-components": "error", 499 | /* 500 | * babel plugin 501 | */ 502 | "babel/generator-star-spacing": [ 503 | "error", 504 | "after" 505 | ], 506 | "babel/new-cap": [ 507 | "error", 508 | { 509 | "capIsNewExceptions": [ 510 | "Immutable" 511 | ] 512 | } 513 | ], 514 | "babel/array-bracket-spacing": [ 515 | "error", 516 | "never" 517 | ], 518 | "babel/object-curly-spacing": [ 519 | "error", 520 | "never" 521 | ], 522 | "babel/object-shorthand": 0, 523 | "babel/arrow-parens": [ 524 | "error", 525 | "always" 526 | ], 527 | "babel/no-await-in-loop": 0 528 | } 529 | } 530 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | 3 | ############ 4 | # Node 5 | ############ 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # node-waf configuration 29 | .lock-wscript 30 | 31 | # Compiled binary addons (http://nodejs.org/api/addons.html) 32 | build/Release 33 | 34 | # Dependency directories 35 | node_modules 36 | jspm_packages 37 | 38 | # Optional npm cache directory 39 | .npm 40 | 41 | # Optional REPL history 42 | .node_repl_history 43 | 44 | ################ 45 | # JetBrains 46 | ################ 47 | .idea 48 | 49 | ## File-based project format: 50 | *.iws 51 | 52 | ## Plugin-specific files: 53 | 54 | # IntelliJ 55 | /out/ 56 | 57 | # mpeltonen/sbt-idea plugin 58 | .idea_modules/ 59 | 60 | # JIRA plugin 61 | atlassian-ide-plugin.xml 62 | 63 | # Crashlytics plugin (for Android Studio and IntelliJ) 64 | com_crashlytics_export_strings.xml 65 | crashlytics.properties 66 | crashlytics-build.properties 67 | fabric.properties 68 | 69 | 70 | ############ 71 | # iOS 72 | ############ 73 | # Xcode 74 | # 75 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 76 | 77 | ## Build generated 78 | ios/build/ 79 | ios/DerivedData/ 80 | 81 | ## Various settings 82 | *.pbxuser 83 | !default.pbxuser 84 | *.mode1v3 85 | !default.mode1v3 86 | *.mode2v3 87 | !default.mode2v3 88 | *.perspectivev3 89 | !default.perspectivev3 90 | ios/xcuserdata/ 91 | 92 | ## Other 93 | *.moved-aside 94 | *.xcuserstate 95 | 96 | ## Obj-C/Swift specific 97 | *.hmap 98 | *.ipa 99 | *.dSYM.zip 100 | *.dSYM 101 | 102 | # CocoaPods 103 | # 104 | # We recommend against adding the Pods directory to your .gitignore. However 105 | # you should judge for yourself, the pros and cons are mentioned at: 106 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 107 | # 108 | ios/Pods/ 109 | 110 | # Carthage 111 | # 112 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 113 | # Carthage/Checkouts 114 | 115 | Carthage/Build 116 | 117 | # fastlane 118 | # 119 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 120 | # screenshots whenever they are needed. 121 | # For more information about the recommended setup visit: 122 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 123 | 124 | fastlane/report.xml 125 | fastlane/screenshots 126 | 127 | 128 | ############ 129 | # Android 130 | ############ 131 | # Built application files 132 | *.apk 133 | *.ap_ 134 | 135 | # Files for the Dalvik VM 136 | *.dex 137 | 138 | # Java class files 139 | *.class 140 | 141 | # Generated files 142 | android/bin/ 143 | android/gen/ 144 | android/out/ 145 | 146 | # Gradle files 147 | android/.gradle/ 148 | android/build/ 149 | 150 | # Local configuration file (sdk path, etc) 151 | local.properties 152 | 153 | # Proguard folder generated by Eclipse 154 | android/proguard/ 155 | 156 | # Log Files 157 | *.log 158 | 159 | # Android Studio Navigation editor temp files 160 | android/.navigation/ 161 | 162 | # Android Studio captures folder 163 | android/captures/ 164 | 165 | # Intellij 166 | *.iml 167 | 168 | # Keystore files 169 | *.jks 170 | 171 | ################## 172 | # React-Native 173 | ################## 174 | # OSX 175 | # 176 | .DS_Store 177 | 178 | # Xcode 179 | # 180 | build/ 181 | *.pbxuser 182 | !default.pbxuser 183 | *.mode1v3 184 | !default.mode1v3 185 | *.mode2v3 186 | !default.mode2v3 187 | *.perspectivev3 188 | !default.perspectivev3 189 | xcuserdata 190 | *.xccheckout 191 | *.moved-aside 192 | DerivedData 193 | *.hmap 194 | *.ipa 195 | *.xcuserstate 196 | project.xcworkspace 197 | 198 | # Android/IJ 199 | # 200 | .idea 201 | .gradle 202 | local.properties 203 | 204 | # node.js 205 | # 206 | node_modules/ 207 | npm-debug.log 208 | 209 | # BUCK 210 | buck-out/ 211 | \.buckd/ 212 | android/app/libs 213 | android/keystores/debug.keystore 214 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | test/ 3 | scripts/ 4 | 5 | .npmignore 6 | 7 | 8 | 9 | ################# 10 | # from .gitignore: 11 | ################ 12 | 13 | 14 | ############ 15 | # Node 16 | ############ 17 | # Logs 18 | logs 19 | *.log 20 | npm-debug.log* 21 | 22 | # Runtime data 23 | pids 24 | *.pid 25 | *.seed 26 | 27 | # Directory for instrumented libs generated by jscoverage/JSCover 28 | lib-cov 29 | 30 | # Coverage directory used by tools like istanbul 31 | coverage 32 | 33 | # nyc test coverage 34 | .nyc_output 35 | 36 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 37 | .grunt 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (http://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules 47 | jspm_packages 48 | 49 | # Optional npm cache directory 50 | .npm 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | ################ 56 | # JetBrains 57 | ################ 58 | .idea 59 | 60 | ## File-based project format: 61 | *.iws 62 | 63 | ## Plugin-specific files: 64 | 65 | # IntelliJ 66 | /out/ 67 | 68 | # mpeltonen/sbt-idea plugin 69 | .idea_modules/ 70 | 71 | # JIRA plugin 72 | atlassian-ide-plugin.xml 73 | 74 | # Crashlytics plugin (for Android Studio and IntelliJ) 75 | com_crashlytics_export_strings.xml 76 | crashlytics.properties 77 | crashlytics-build.properties 78 | fabric.properties 79 | 80 | 81 | ############ 82 | # iOS 83 | ############ 84 | # Xcode 85 | # 86 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 87 | 88 | ## Build generated 89 | ios/build/ 90 | ios/DerivedData/ 91 | 92 | ## Various settings 93 | *.pbxuser 94 | !default.pbxuser 95 | *.mode1v3 96 | !default.mode1v3 97 | *.mode2v3 98 | !default.mode2v3 99 | *.perspectivev3 100 | !default.perspectivev3 101 | ios/xcuserdata/ 102 | 103 | ## Other 104 | *.moved-aside 105 | *.xcuserstate 106 | 107 | ## Obj-C/Swift specific 108 | *.hmap 109 | *.ipa 110 | *.dSYM.zip 111 | *.dSYM 112 | 113 | # CocoaPods 114 | # 115 | # We recommend against adding the Pods directory to your .gitignore. However 116 | # you should judge for yourself, the pros and cons are mentioned at: 117 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 118 | # 119 | ios/Pods/ 120 | 121 | # Carthage 122 | # 123 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 124 | # Carthage/Checkouts 125 | 126 | Carthage/Build 127 | 128 | # fastlane 129 | # 130 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 131 | # screenshots whenever they are needed. 132 | # For more information about the recommended setup visit: 133 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 134 | 135 | fastlane/report.xml 136 | fastlane/screenshots 137 | 138 | 139 | ############ 140 | # Android 141 | ############ 142 | # Built application files 143 | *.apk 144 | *.ap_ 145 | 146 | # Files for the Dalvik VM 147 | *.dex 148 | 149 | # Java class files 150 | *.class 151 | 152 | # Generated files 153 | android/bin/ 154 | android/gen/ 155 | android/out/ 156 | 157 | # Gradle files 158 | .gradle/ 159 | android/.gradle/ 160 | android/build/ 161 | android/*/build/ 162 | 163 | # Local configuration file (sdk path, etc) 164 | local.properties 165 | 166 | # Proguard folder generated by Eclipse 167 | android/proguard/ 168 | 169 | # Log Files 170 | *.log 171 | 172 | # Android Studio Navigation editor temp files 173 | android/.navigation/ 174 | 175 | # Android Studio captures folder 176 | android/captures/ 177 | 178 | # Intellij 179 | *.iml 180 | 181 | # Keystore files 182 | *.jks 183 | 184 | ################## 185 | # React-Native 186 | ################## 187 | # OSX 188 | # 189 | .DS_Store 190 | 191 | # Xcode 192 | # 193 | build/ 194 | *.pbxuser 195 | !default.pbxuser 196 | *.mode1v3 197 | !default.mode1v3 198 | *.mode2v3 199 | !default.mode2v3 200 | *.perspectivev3 201 | !default.perspectivev3 202 | xcuserdata 203 | *.xccheckout 204 | *.moved-aside 205 | DerivedData 206 | *.hmap 207 | *.ipa 208 | *.xcuserstate 209 | project.xcworkspace 210 | 211 | # Android/IJ 212 | # 213 | .idea 214 | android/.idea 215 | android/.gradle 216 | android/local.properties 217 | 218 | # node.js 219 | # 220 | node_modules/ 221 | npm-debug.log 222 | 223 | # BUCK 224 | buck-out/ 225 | \.buckd/ 226 | android/app/libs 227 | android/keystores/debug.keystore 228 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Wix.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](https://faceswaponline.com/wp-content/uploads/2017/04/missionaccomplished-6c17ad8ad9409d21748f9168c4e74e90.jpg) 2 | # Deprecated, use FlatList instead. 3 | 4 | # Sane ListView 5 | Why do we need all this datasource nonsense?! 6 | 7 | ## Usage 8 | 9 | Just like any other react-native ListView, except the datasource is passed as props (rowsById and rowsIdArray): 10 | 11 | ```jsx 12 | 17 | ``` 18 | 19 | **A simple example:** 20 | 21 | ```js 22 | import SaneListView from 'react-native-sane-listview'; 23 | ``` 24 | 25 | and then in your class 26 | 27 | ```jsx 28 | constructor(props) { 29 | super(props); 30 | this.state = { 31 | data: [{name:'Dan'},{name:'Lisa'}] 32 | }; 33 | 34 | reload = () => { 35 | this.setState({'data':[{name:'John'}]}); 36 | }; 37 | 38 | setTimeout(reload, 3000); 39 | } 40 | render() { 41 | return ( 42 | {rowData.name}} 45 | /> 46 | ); 47 | } 48 | ``` 49 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import SaneListView from './src/SaneListView'; 2 | 3 | export default SaneListView; 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-sane-listview", 3 | "version": "1.0.4", 4 | "description": "Why do we need all this datasource nonsense?!", 5 | "license": "MIT", 6 | "keywords": [ 7 | "React", 8 | "Native", 9 | "ListView" 10 | ], 11 | "author": "Daniel Zlotin ", 12 | "publishConfig": { 13 | "registry": "https://registry.npmjs.org/" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/wix/react-native-sane-listview.git" 18 | }, 19 | "bugs": { 20 | "url": "https://github.com/wix/react-native-sane-listview/issues" 21 | }, 22 | "homepage": "https://github.com/wix/react-native-sane-listview", 23 | "main": "index.js", 24 | "scripts": { 25 | "build": ":", 26 | "lint": "eslint src test", 27 | "pretest": "npm run lint", 28 | "test": ":", 29 | "release": "npm version patch && npm publish && git push" 30 | }, 31 | "dependencies": { 32 | "lodash": "^4.12.0" 33 | }, 34 | "peerDependencies": { 35 | "react-native": "*" 36 | }, 37 | "devDependencies": { 38 | "app-root-path": "^1.0.0", 39 | "babel-cli": "^6.8.0", 40 | "babel-core": "^6.8.0", 41 | "babel-polyfill": "^6.8.0", 42 | "babel-register": "^6.8.0", 43 | "babel-preset-stage-0": "^6.0.0", 44 | "babel-preset-es2015": "^6.0.0", 45 | "jasmine": "^2.4.1", 46 | "jasmine-reporters": "^2.1.1", 47 | "jasmine-spec-reporter": "^2.4.0", 48 | "jasmine-expect": "^2.0.2", 49 | "proxyquire": "1.7.4", 50 | "eslint": "^2.5.1", 51 | "eslint-plugin-babel": "^3.0.0", 52 | "eslint-plugin-react": "^4.2.3", 53 | "eslint-plugin-react-native": "^1.0.0", 54 | "babel-eslint": "^6.0.4" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/SaneListView.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {ListView} from 'react-native'; 3 | 4 | const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); 5 | 6 | export default class SaneListView extends Component { 7 | constructor(props) { 8 | super(props); 9 | this.state = { 10 | dataSource: ds.cloneWithRows(this.props.rowsById, this.props.rowsIdArray) 11 | }; 12 | } 13 | 14 | componentWillReceiveProps(nextProps) { 15 | if (this.props.rowsById !== nextProps.rowsById) { 16 | this.setState({ 17 | dataSource: ds.cloneWithRows(nextProps.rowsById, nextProps.rowsIdArray) 18 | }); 19 | } 20 | } 21 | 22 | render() { 23 | return ( 24 | 28 | ); 29 | } 30 | } 31 | --------------------------------------------------------------------------------