├── .gradle ├── 2.14.1 │ ├── taskArtifacts │ │ ├── cache.properties │ │ ├── cache.properties.lock │ │ ├── fileHashes.bin │ │ ├── fileSnapshots.bin │ │ ├── fileSnapshotsToTreeSnapshotsIndex.bin │ │ └── taskArtifacts.bin │ └── tasks │ │ └── _app_compileDebugJavaWithJavac │ │ ├── localClassSetAnalysis │ │ ├── localClassSetAnalysis.bin │ │ └── localClassSetAnalysis.lock │ │ └── localJarClasspathSnapshot │ │ ├── localJarClasspathSnapshot.bin │ │ └── localJarClasspathSnapshot.lock └── 2.4 │ └── taskArtifacts │ ├── cache.properties │ ├── cache.properties.lock │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── outputFileStates.bin │ └── taskArtifacts.bin ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── workspace.xml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── customlistview │ │ ├── CustomAdapter.java │ │ ├── ListViewCell.java │ │ ├── ListViewPackage.java │ │ ├── MyViewHolder.java │ │ └── ReactListViewManager.java │ └── res │ ├── layout │ └── movie_list_row.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ └── values │ ├── strings.xml │ └── styles.xml ├── index.js └── package.json /.gradle/2.14.1/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 25 11:00:01 IST 2016 2 | -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 25 10:57:36 IST 2016 2 | -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.4/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.4/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.4/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.4/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/.gradle/2.4/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 113 | 114 | 115 | 122 | 123 | 124 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 163 | 164 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 193 | 194 | 195 | 196 | 210 | 211 | 212 | 213 | 214 | 215 | 222 | 223 | 224 | 225 | 243 | 250 | 251 | 259 | 260 | 262 | 263 | 264 | 266 | 267 | 268 | 269 | 1477454692722 270 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at rameshvishnoi90904@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 rameshvishnoi 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 | # react-native-recycler-listview 2 | 3 | Custom Component for ListView in Android using RecyclerView 4 | 5 | Installation 6 | > npm install react-native-recycler-listview 7 | 8 | or 9 | 10 | > git clone https://github.com/rameshvishnoi90904/react-native-recycler-listview.git 11 | 12 | ##step 1: In settings.gradle 13 | ``` 14 | include ':ReactNativeRecyclerListview' 15 | project(':ReactNativeRecyclerListview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-recycler-listview/android') 16 | ``` 17 | 18 | ##step 2: In android/app/build.gradle 19 | ``` 20 | dependencies { 21 | compile project(':ReactNativeRecyclerListview') 22 | } 23 | ``` 24 | 25 | ##step 3: In MainApplication.java 26 | 27 | ``` 28 | 29 | import com.customlistview.ListViewPackage; 30 | 31 | 32 | @Override protected List getPackages() { 33 | return Arrays.asList( 34 | new MainReactPackage(), 35 | new ListViewPackage() 36 | ); 37 | } 38 | 39 | ``` 40 | ##step 4: In index.js 41 | ```javascript 42 | import ListViewCustom from 'react-native-recycler-listview'; 43 | 44 | constructor(props) { 45 | super(props); 46 | var array = []; 47 | for(var i = 0; i < 1000; i++){ 48 | array.push({"title":"Title","subtitle":"subtiles"}); 49 | } 50 | this.state = { 51 | dataSource:{"names": array} 52 | }; 53 | } 54 | 55 | render() { 56 | return ( 57 | 58 | 62 | 63 | 64 | ); 65 | } 66 | ``` 67 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.library" 2 | 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "23.0.1" 7 | 8 | defaultConfig { 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | 18 | } 19 | 20 | dependencies { 21 | compile fileTree(dir: "libs", include: ["*.jar"]) 22 | compile "com.android.support:appcompat-v7:23.0.1" 23 | compile "com.facebook.react:react-native:+" // From node_modules 24 | } 25 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /android/src/main/java/com/customlistview/CustomAdapter.java: -------------------------------------------------------------------------------- 1 | package com.customlistview; 2 | 3 | import android.graphics.Color; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.facebook.react.bridge.ReadableMap; 12 | 13 | import java.util.List; 14 | 15 | import static android.support.v7.widget.RecyclerView.*; 16 | 17 | /** 18 | * Created by root on 25/10/16. 19 | */ 20 | 21 | public class CustomAdapter extends RecyclerView.Adapter { 22 | String TAG = "react"; 23 | Float fontSize; 24 | int padding; 25 | String fontColor; 26 | private List list; 27 | 28 | public CustomAdapter(List list) { 29 | this.list = list; 30 | } 31 | 32 | public void setStyles(ReadableMap src){ 33 | fontColor = src.getString("fontColor"); 34 | fontSize = Float.parseFloat(src.getString("fontSize")); 35 | padding = Integer.parseInt(src.getString("padding")); 36 | } 37 | 38 | @Override 39 | public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 40 | View itemView = LayoutInflater.from(parent.getContext()) 41 | .inflate(R.layout.movie_list_row, parent, false); 42 | return new MyViewHolder(itemView,fontSize,fontColor,padding); 43 | } 44 | 45 | @Override 46 | public void onBindViewHolder(MyViewHolder holder, int position) { 47 | ListViewCell listViewCell = list.get(position); 48 | holder.title.setText(listViewCell.getTitle()); 49 | holder.subtitle.setText(listViewCell.getSubtitle()); 50 | } 51 | 52 | @Override 53 | public int getItemCount() { 54 | return list.size(); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /android/src/main/java/com/customlistview/ListViewCell.java: -------------------------------------------------------------------------------- 1 | package com.customlistview; 2 | 3 | /** 4 | * Created by root on 25/10/16. 5 | */ 6 | 7 | public class ListViewCell { 8 | private String title, subtitle; 9 | 10 | public ListViewCell(String title,String subtitle) { 11 | this.title = title; 12 | this.subtitle = subtitle; 13 | } 14 | 15 | public ListViewCell(String title, String genre, String year) { 16 | this.title = title; 17 | } 18 | 19 | public String getTitle() { 20 | return title; 21 | } 22 | public String getSubtitle() { 23 | return subtitle; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /android/src/main/java/com/customlistview/ListViewPackage.java: -------------------------------------------------------------------------------- 1 | package com.customlistview; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Arrays; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by root on 25/10/16. 16 | */ 17 | 18 | public class ListViewPackage implements ReactPackage { 19 | 20 | @Override 21 | public List createNativeModules(ReactApplicationContext reactContext) { 22 | return Collections.emptyList(); 23 | } 24 | 25 | @Override 26 | public List> createJSModules() { 27 | return Collections.emptyList(); 28 | } 29 | 30 | @Override 31 | public List createViewManagers(ReactApplicationContext reactContext) { 32 | return Arrays.asList( 33 | new ReactListViewManager() 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android/src/main/java/com/customlistview/MyViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.customlistview; 2 | 3 | import android.graphics.Color; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | /** 9 | * Created by root on 25/10/16. 10 | */ 11 | 12 | 13 | public class MyViewHolder extends RecyclerView.ViewHolder { 14 | public TextView title, subtitle; 15 | 16 | public MyViewHolder(View view) { 17 | super(view); 18 | title = (TextView) view.findViewById(R.id.title); 19 | subtitle = (TextView) view.findViewById(R.id.subtitle); 20 | 21 | } 22 | 23 | public MyViewHolder(View view, Float fontSize, String fontColor, int padding) { 24 | super(view); 25 | title = (TextView) view.findViewById(R.id.title); 26 | subtitle = (TextView) view.findViewById(R.id.subtitle); 27 | title.setTextSize(fontSize+20); 28 | title.setTextColor(Color.parseColor(fontColor)); 29 | 30 | subtitle.setTextSize(fontSize); 31 | subtitle.setTextColor(Color.parseColor(fontColor)); 32 | view.setPadding(padding,padding,padding,padding); 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /android/src/main/java/com/customlistview/ReactListViewManager.java: -------------------------------------------------------------------------------- 1 | package com.customlistview; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v7.widget.DefaultItemAnimator; 5 | import android.support.v7.widget.LinearLayoutManager; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.util.Log; 8 | 9 | import com.facebook.react.bridge.ReadableArray; 10 | import com.facebook.react.bridge.ReadableMap; 11 | import com.facebook.react.uimanager.SimpleViewManager; 12 | import com.facebook.react.uimanager.ThemedReactContext; 13 | import com.facebook.react.uimanager.ViewProps; 14 | import com.facebook.react.uimanager.annotations.ReactProp; 15 | 16 | import org.json.JSONArray; 17 | import org.json.JSONException; 18 | import org.json.JSONObject; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Iterator; 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | import static com.facebook.react.common.ReactConstants.TAG; 26 | 27 | /** 28 | * Created by root on 25/10/16. 29 | */ 30 | 31 | public class ReactListViewManager extends SimpleViewManager { 32 | private List list = new ArrayList<>(); 33 | private RecyclerView recyclerView; 34 | private CustomAdapter mAdapter; 35 | 36 | @Override 37 | public String getName() { 38 | return "RCTListView"; 39 | } 40 | 41 | @Override 42 | protected RecyclerView createViewInstance(ThemedReactContext reactContext) { 43 | mAdapter = new CustomAdapter(list); 44 | return new RecyclerView(reactContext); 45 | } 46 | @ReactProp(name = "src") 47 | public void setSrc(RecyclerView view,@Nullable ReadableMap src) { 48 | 49 | 50 | view.setHasFixedSize(true); 51 | RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(view.getContext()); 52 | view.setLayoutManager(mLayoutManager); 53 | view.setItemAnimator(new DefaultItemAnimator()); 54 | view.setAdapter(mAdapter); 55 | prepareMovieData(src); 56 | 57 | 58 | 59 | } 60 | 61 | @ReactProp(name = "customStyle") 62 | public void setBorderRadius(RecyclerView view, @Nullable ReadableMap src) { 63 | Log.d(TAG, "setBorderRadius() [" + src + "]"); 64 | mAdapter.setStyles(src); 65 | } 66 | 67 | 68 | private void prepareMovieData(ReadableMap map){ 69 | 70 | ReadableArray obj = map.getArray("names"); 71 | for(int i = 0; i 2 | 8 | 9 | 17 | 23 | 24 | -------------------------------------------------------------------------------- /android/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/android/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/android/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/android/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rameshvishnoi90904/react-native-recycler-listview/6b6e73b30b9872885321a99b11b86988d3497699/android/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CustomListView 3 | #eecc00 4 | 5 | -------------------------------------------------------------------------------- /android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | import { PropTypes } from 'react'; 3 | import { requireNativeComponent, View } from 'react-native'; 4 | 5 | var iface = { 6 | name: 'ImageView', 7 | propTypes: { 8 | src: PropTypes.object, 9 | customStyle: PropTypes.object, 10 | ...View.propTypes // include the default view properties 11 | }, 12 | }; 13 | 14 | module.exports = requireNativeComponent('RCTListView', iface); 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-recycler-listview", 3 | "version": "0.1.0", 4 | "description": "A React Native RecyclerView ListView Module", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react", 11 | "react-native", 12 | "react-component", 13 | "android", 14 | "listview", 15 | "recyclerview", 16 | "memory-efficient" 17 | ], 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/rameshvishnoi90904/react-native-recycler-listview.git" 21 | }, 22 | "author": "RameshVishnoi", 23 | "peerDependencies": { 24 | "react-native": ">=0.17" 25 | } 26 | } 27 | --------------------------------------------------------------------------------