Can't display React Native Android native component -


i'm trying bridge android native view make available in js. i've followed official guide can't display. far, i've coded following.

viewmanager.java

public class reactprogressbar extends simpleviewmanager<progressbar> {      public static final string react_class = "progressbar";       @override     public string getname() {         return react_class;     }      @override     protected progressbar createviewinstance(themedreactcontext reactcontext) {         return new progressbar(reactcontext, null);     }       @reactprop(name = "progress", defaultint = 0)     public void setprogress(progressbar view, int progress) {         view.setprogress(progress);     }      @reactprop(name = "indeterminate",           defaultboolean = false)     public void setindeterminate(progressbar view,                                  boolean indeterminate) {         view.setindeterminate(indeterminate);     }  } 

reactpackage.java

public class reacttextpackage implements reactpackage {     @override     public list<nativemodule> createnativemodules(reactapplicationcontext reactcontext) {         return collections.emptylist();     }      @override     public list<viewmanager> createviewmanagers(reactapplicationcontext reactcontext) {         return arrays.<viewmanager>aslist( new reacttextmanager() );    } } 

mainapplication.java

...     @override         protected list<reactpackage> getpackages() {           return arrays.<reactpackage>aslist(               ...,                 new reacttextpackage()           );         }       }; ... 

progressbar.js

import proptypes 'prop-types'; import { requirenativecomponent, view, viewproptypes } 'react-native';  let iface = {     name: 'progressbar',     proptypes: {         progress: proptypes.number,         indeterminate: proptypes.bool,         ...viewproptypes // include default view properties     }, };  export default requirenativecomponent('progressbar', iface); 

so far, component not displaying. no error shown in console.

to create android progressbar, need pass style it. modify createviewinstance following:

@override protected progressbar createviewinstance(themedreactcontext reactcontext) {     progressbar progressbar = new progressbar(reactcontext, null, android.r.attr.progressbarstylehorizontal);     progressbar.setmax(100);     return progressbar; } 

find progressbar styles here


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -