maolion / mao-rn-android-kit Goto Github PK
View Code? Open in Web Editor NEW⚙️ Android Native (ui components and modules) wrap in React Native
⚙️ Android Native (ui components and modules) wrap in React Native
Hello @maolion, so I copied and ran your example with ListView
and RefreshControl
, but the app crashes each time I tried to increase the number of rows in the list above the 10 rows you used in the example. Please do you know why this may be happening?
Thank you.
Hi, thanks for the awesome library!
I'm experiencing a problem with collapsing toolbar. Content stops scrolling when keyboard is displayed and hidden. Here is a video that demonstrates the problem: https://drive.google.com/file/d/0B6CLZ40sQhczNGVtaGxsZDJiT01VTi1DcEl6cjE4dFNsQUlB/view
You can also checkout this commit to see my demo code: halilb@a7e5bdf
Thanks again!
Hello!
Firstly, thank you for your work on this packaged. I know many people use it.
I am currently trying to use this (hiding/showing header on scroll), but since ListView with RecyclerViewBackedScrollView is being deprecated.
facebook/react-native#11445
facebook/react-native#11095
facebook/react-native#7002
It is also too buggy and no one wants to maintain it on official RN repository.
https://github.com/facebook/react-native/issues?utf8=%E2%9C%93&q=RecyclerViewBackedScrollView
What is the alternative? I am not a native developer, but it seems that using NestedScrollViewAndroid is not going to perform very well on large infinite scrolling lists and there is no way of getting pull-to-refresh.
After upgrade react to 0.43. Appbarlayout stopped working
react-native-cli: 2.0.1
react-native: 0.41.2
编译错误,希望能看一下
/node_modules/mao-rn-android-kit/android/src/main/java/com/maornandroidkit/managers/NestedScrollViewManager.java:19: 错误: NestedScrollViewManager不是抽象的, 并且未覆盖ScrollCommandHandler中的抽象方法scrollToEnd(MNestedScrollView,ScrollToEndCommandData)
public class NestedScrollViewManager
^
注: /node_modules/mao-rn-android-kit/android/src/main/java/com/maornandroidkit/managers/NestedScrollViewManager.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
1 个错误
:mao-rn-android-kit:compileReleaseJavaWithJavac FAILED
Hi @maolion,
I really appreciate your work on this package. It did save my day however, I've got one problem when i used NestedScrollView under CoordinatorLayout there are always some items that i can't scroll to, They just stay invisible and unreachable, I just wanted to know if you have any advice regarding that problem.
Code
export default class Example extends Component {
render() {
var highSelected = (this.state.highSelected ? {
textStyle: styles.highNormalLowDocListHeaderStateTextSelected,
borderStyle: styles.highNormalLowDocListHeaderStateBorderSelected
} : {});
var normalSelected = (this.state.normalSelected ? {
textStyle: styles.highNormalLowDocListHeaderStateTextSelected,
borderStyle: styles.highNormalLowDocListHeaderStateBorderSelected
} : {});
var lowSelected = (this.state.lowSelected ? {
textStyle: styles.highNormalLowDocListHeaderStateTextSelected,
borderStyle: styles.highNormalLowDocListHeaderStateBorderSelected
} : {});
return (
<View style={{flex: 1, backgroundColor: '#FFF'}}>
<CoordinatorLayoutAndroid ref={(component) => this.coordinatorLayout = component}
fitsSystemWindows={false}>
<AppBarLayoutAndroid
layoutParams={{
width: 'match_parent',
height: 112
}}
style={{ backgroundColor:"#528eff" }}>
<View layoutParams={{height: 56, width: this.windowWidth, scrollFlags: (
AppBarLayoutAndroid.SCROLL_FLAG_SCROLL |
AppBarLayoutAndroid.SCROLL_FLAG_ENTRY_ALWAYS)}} style={{height: 56}}>
<ToolbarAndroid
titleColor={'#FFF'}
title={this.props.title}
navIcon={images.arrowBack}
onIconClicked={() => this._goBack()}
onActionSelected={() => {}}
actions={[{title: 'Search', icon: images.search, show: 'always'}]}
style={[{backgroundColor: '#528eff', width: this.windowWidth, height: 56}]}/>
</View>
<View layoutParams={{height: 56, width: this.windowWidth}}
style={{flex: 0, flexDirection: 'row', justifyContent: 'center', width: this.windowWidth, backgroundColor: '#528eff'}}>
<TouchableOpacity onPress={() => this.getDocuments('high')}
style={[styles.highNormalLowDocListHeaderStateTextContainer, highSelected.borderStyle]}>
<Text
style={[styles.highNormalLowDocListHeaderStateText, highSelected.textStyle]}>HIGH</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.getDocuments('normal')}
style={[styles.highNormalLowDocListHeaderStateTextContainer, normalSelected.borderStyle]}>
<Text
style={[styles.highNormalLowDocListHeaderStateText, normalSelected.textStyle]}>NORMAL</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.getDocuments('low')}
style={[styles.highNormalLowDocListHeaderStateTextContainer, lowSelected.borderStyle]}>
<Text
style={[styles.highNormalLowDocListHeaderStateText, lowSelected.textStyle]}>LOW</Text>
</TouchableOpacity>
</View>
</AppBarLayoutAndroid>
<NestedScrollViewAndroid
ref={(component) => this.contentLayout = component}
style={{flex: 1, backgroundColor: 'transparent', height: this.windowHeight - 136}}>
<ListView
dataSource={this.state.documents}
enableEmptySections={true}
renderRow={(rowData) => this._renderRow(rowData)}
/>
</NestedScrollViewAndroid>
</CoordinatorLayoutAndroid>
<ActivityIndicator
animating={this.state.animating}
style={[{width: this.windowWidth, height: 80, position: 'absolute', top: this.loaderMargin, bottom: 0}]}
size="large"
/>
</View>
);
}
}
Thanks for your hard work first. The NestedScrollView plays in my app very well with the CoordinatorLayout, however I notice that the vertical scroll bars doesn't show at all, and the example demo app seems the same:
I have tried the property showVerticalScrollIndicator
but it has no effect. Is there something wrong with the way I use NestedScrollView? Thanks in advance
Code
`class CoordinatorLayoutWithTabExample extends Component{
_tabTexts = [
{ text: "tab1" },
{ text: "tab2" },
{ text: "tab3" }
];
componentDidMount() {
this.refs.coordinatorLayout.setScrollingViewBehavior(this.refs.viewPager);
this._tabLayout.setViewPager(this._viewPager, this._tabTexts);
}
render() {
return (
<View style={[ { flex: 1}]}>
<CoordinatorLayoutAndroid ref="coordinatorLayout">
<AppBarLayoutAndroid
style={{height: 250}}
layoutParams={{
width: width,
scrollFlag: AppBarLayoutAndroid.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
}}
>
<CollapsingToolbarLayoutAndroid
expandedTitleMarginStart={20}
expandedTitleMarginBottom={20}
collapsedTitleColor="#ffffff"
contentScrimColor="#2278F6"
expandedTitleColor="#ffffff"
layoutParams={{
scrollFlags: (
AppBarLayoutAndroid.SCROLL_FLAG_SCROLL |
AppBarLayoutAndroid.SCROLL_FLAG_SNAP |
AppBarLayoutAndroid.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
)
}}>
<View
style={{
flex: 1,
backgroundColor: '#4CAF50'
}}
layoutParams={{
collapseParallaxMultiplie: 0.7,
collapseMode: CollapsingToolbarLayoutAndroid.CollapseMode.COLLAPSE_MODE_PARALLAX
}}>
<Image source={require('./images/beer.jpg')} style={styles.image} />
</View>
<ToolbarAndroid
title="Collapsing Toolbar Layout"
titleColor="#ffffff"
layoutParams={{
height: 56, // required
collapseMode: CollapsingToolbarLayoutAndroid.CollapseMode.COLLAPSE_MODE_PIN // required
}}>
</ToolbarAndroid>
</CollapsingToolbarLayoutAndroid>
<View style={{height: 38, backgroundColor: '#4889f1'}}>
<TabLayoutAndroid
tabMode="scrollable"
tabSelectedTextColor="#fff"
tabIndicatorColor="#fff"
tabTextColor="rgba(255, 255, 255, .6)"
tabIndicatorHeight={1}
tabTextSize={6}
tabSidePadding={10}
tabHeight={38}
ref={(component) => {
this._tabLayout = component;
}} />
</View>
</AppBarLayoutAndroid>
<ViewPagerAndroid
ref="viewPager"
style={{ backgroundColor: 'transparent' }}
>
<FlatList
data={data}
renderItem={this.renderBox}
renderScrollComponent={this.renderScroll}
/>
<FlatList
data={data}
renderItem={this.renderBox}
renderScrollComponent={this.renderScroll}
/>
<FlatList
data={data}
renderItem={this.renderBox}
renderScrollComponent={this.renderScroll}
/>
</ViewPagerAndroid>
</CoordinatorLayoutAndroid>
</View>
);
};
renderBox(item) {
return (
<View style={styles.box} />
)
}
renderScroll(props) {
return (
<NestedScrollViewAndroid {...props} style={styles.nestedScroll} />
)
}
};`
想要CollapsingToolbarLayoutAndroid, AppBarLayoutAndroid, CollapsingToolbarLayoutAndroid和TabLayoutAndroid同时使用,也就是内容的下半部分是tab,通过滚动能够实现tab标题部分的置顶。
我用上面的代码试了下,其他都很好(tab页也可以左右滑动),但是tab的标题(this._tabTexts)不显示。
麻烦您帮忙看看。。。
Hello @maolion,
Thanks for your work on this package. Was wondering if the CollapsingToolbarLayout
is in your feature roadmap or would you be adding it sometime soon?
Cheers!
Would it be difficult to implement the NavigationView from https://android-developers.googleblog.com/2015/05/android-design-support-library.html ?
Specially for the part of fitsSystemWindows
so the drawer goes nicely above the status bar.
Hello,
If I'm going to put a TextInput inside a NestedScrollViewAndroid and click on the TextInput an error is raises from the ScrollResponder:
Code Example:
<NestedScrollViewAndroid
style={{ height: Dimensions.get('window').height - 70 }}
>
<TextInput
style={{ height: 50, backgroundColor: 'yellow' }}
>
</TextInput>
</NestedScrollViewAndroid>
My dependencies are:
"mao-rn-android-kit": "^0.3.21",
"react": "15.4.1",
"react-native": "0.39.2",
你好,我尝试引入这个组件,然后遇到了一个编译错误,希望你可以帮我看看。
"react": "16.2.0"
"react-native": "0.52.2"
compileSdkVersion 23
buildToolsVersion "23.0.1"
minSdkVersion 16
targetSdkVersion 22
:mao-rn-android-kit:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:mao-rn-android-kit:compileReleaseJavaWithJavac
:mao-rn-android-kit:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
E:\mygit\react-native-image-header-scroll-view-example\node_modules\mao-rn-android-kit\android\src\main\java\com\maornandroidkit\KitsPackage.java:32: 错误: 方法不会覆盖或实现超类型的方法
@Override
^
E:\mygit\react-native-image-header-scroll-view-example\node_modules\mao-rn-android-kit\android\src\main\java\com\maornandroidkit\managers\NestedScrollViewManager.java:20: 错误: NestedScrollVie
wManager不是抽象的, 并且未覆盖ScrollCommandHandler中的抽象方法flashScrollIndicators(MNestedScrol
lView)
public class NestedScrollViewManager
^
E:\mygit\react-native-image-header-scroll-view-example\node_modules\mao-rn-android-kit\android\src\main\java\com\maornandroidkit\widgets\MNestedScrollView.java:35: 错误: 无法将类 ScrollEvent中
的方法 obtain应用到给定类型;
ScrollEvent.obtain(
^
需要: int,ScrollEventType,int,int,float,float,int,int,int,int
找到: int,ScrollEventType,int,int,int,int,int,int
原因: 实际参数列表和形式参数列表长度不同
注: E:\mygit\react-native-image-header-scroll-view-example\node_modules\mao-rn-android-kit\andro id\src\main\java\com\maornandroidkit\widgets\MTabLayout.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: E:\mygit\react-native-image-header-scroll-view-example\node_modules\mao-rn-android-kit\andro id\src\main\java\com\maornandroidkit\managers\NestedScrollViewManager.java使用了未经检查或不安全
的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
3 个错误
:mao-rn-android-kit:compileReleaseJavaWithJavac FAILED
Init new project
React-native 0.43.0
at p.catch.error (/Users/Reuf/yd/examplekitmao/ex/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:366:19)
at process._tickCallback (internal/process/next_tick.js:103:7)
Bundling `index.android.js` 0.0% (0/1), failed.
UnableToResolveError: Unable to resolve module `react-mixins-decorator` from `/Users/Reuf/yd/examplekitmao/ex/node_modules/mao-rn-android-kit/components/nested-scroll-view.js`: Module does not exist in the module map or in these directories:
/Users/Reuf/yd/examplekitmao/ex/node_modules
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start --reset-cache`.
at p.catch.error (/Users/Reuf/yd/examplekitmao/ex/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:366:19)
at process._tickCallback (internal/process/next_tick.js:103:7)
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import {
ExtraDimensionsAndroid,
AppBarLayoutAndroid,
CoordinatorLayoutAndroid,
NestedScrollViewAndroid
} from 'mao-rn-android-kit';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class ex extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('ex', () => ex);
你好,我用了你的库,很好用,但我有个新的功能遇到点问题,我在NestedScrollViewAndroid里面添加listview可以正常滚动,但是listview加上下拉刷新功能时,下拉刷新不能运行出来,请问有好的解决吗?
您好,问一个问题:我在整合native code与react code的时候出现一个问题,我是想将native端的一个ListView作为一个原生UI组件给react native使用,然而native端的ListView数据的改变不会引起reactnative
ui的重绘,需要我重新scroll以下界面才能重新出来,请问博主有没有什么解决思路?
Hello @maolion,
I was wondering if you can share your sample app (as shown in the gif you have on the README) - perhaps as a folder on this repo? This would simplify getting started with your library. Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.