im new to react native,i want to a stepIndicator exactly like in above picture.. But rn StepIndicator is not looking good even though i cant increase the seperator height and i cant add some text in middle of steps like payment date etc.., titles also not aligning straight and i can only change colors and width of steps and seperators. So i tried to make customized StepIndicator but im unable to it.
const labels = [{title:"Order Subscribed",},{title:"Payment",},{title:"Dispatched",},{title:"site",}];
const stepIndicatorStyles = {
stepIndicatorSize: 20,
currentStepIndicatorSize:20,
separatorStrokeWidth: 1,
currentStepStrokeWidth: 20,
stepStrokeCurrentColor: '#FFAA01',
separatorFinishedColor: '#aaaaaa',
separatorUnFinishedColor: '#aaaaaa',
stepIndicatorFinishedColor: '#FFAA01',
stepIndicatorUnFinishedColor: '#636363',
stepIndicatorCurrentColor: '#FFAA01',
stepIndicatorLabelFontSize: 0,
currentStepIndicatorLabelFontSize: 0,
stepIndicatorLabelCurrentColor: '#000000',
stepIndicatorLabelFinishedColor: '#FFAA01',
stepIndicatorLabelUnFinishedColor: 'rgba(255,255,255,0.5)',
labelColor: 'black',
labelSize: 18,
currentStepLabelColor: 'black'
}
In class in render() method..
<StepIndicator
customStyles={stepIndicatorStyles}
currentPosition={this.state.currentPosition}
stepCount={4}
direction='vertical'
labels={labels.map(title => title.title)}
/>
Please help me to solve this. Im trying to get achieve this from 2 weeks but failed. Thanks in advance..
Related
I have this style in react-native
backgroundColor: 'rgba(0, 0, 0, 0.8)',
but It gives me this eslint warning Warning eslint(react-native/no-color-literals)
I tried this styling but it didn't work
{
backgroundColor: BLACK,
opacity: 0.8
}
Please check this link to understand the warning.
When developing UIs, we often find ourselves reusing the same colors in multiple places in the UI. If the colors have to be updated, they likely have to be updated across the board. So it's good practice to store the color definitions in variables instead of hardcoding them inside styles. This rule will detect color properties that have literals (ie strings) as values.
You can either disable this warning on eslint or put the string into a variable.
const blackOpa80 = 'rgba(0, 0, 0, 0.8)'
And then:
backgroundColor: blackOpa80,
I kind of new using animation, im using react native reanimated to create some animations, but i really dont understand how interpolate works, the input range, output range, the animation that i want its inside a scrollview, each item should has its own Animated.View, so the first one will be 100% width and the rest will be like 20%, i want to create this design:
for now my code is this:
const animatedWidth = useAnimatedStyle(() => {
const width_ = interpolate(
cardWidth,
[0,1, 2],
[4, 4, 5],
);
return {
width: width_,
};
});
return (
<>
<Animated.ScrollView horizontal = {true}>
{
extras.map((extra) => {
return (
<>
<Animated.View style = {[{height: 220, margin: 5}, animatedWidth]}>
<ImageBackground
source = {require("../assets/images/hawai.jpeg")}
style = {{width: "100%", height: "100%"}}
imageStyle = {{borderRadius: 30
}}>
[![</Animated.View][2]][2]>
)}
}
<Animated.ScrollView>
)
and this is the result:
i can scroll and it "works" and i want to make it work like the first design, the first full width and the others 20% width, but i really dont understand the interpol and the inputRange to make them appears, if someone knows and can explain to me in simple works really greateful, searched for videos and documentation but like i said still dont understand, thanks :)
I am new to flutter I am stuck I want images sliding images after ontap ! like our gallery app...
but the thing is images slide from privious array...suppose 1st screen I have 10 images list I opened 6 image to next screen to show full screen and when I slide on that page I want after that image I want to see 7 no or 5 no images...hope u get my point
body: Stack(
children: <Widget>[
Container(
child:
Center(
child: Swiper(
autoplay: false,
itemBuilder: (BuildContext context, int index) {
return new PhotoView(
imageProvider: NetworkImage(widget.Backgroundimg,),
minScale: PhotoViewComputedScale.contained * 0.8,
maxScale: PhotoViewComputedScale.covered * 1.5,
);
},
itemCount: 10,
viewportFraction: 1,
scale: 0.9,
),
),
),
here is my body I use json for image listing......After that sending images through widget please help me for sliding array thank you
I would recommend to use Carousel Slider as it will also provide many options and suitable for gallery app.
https://pub.dev/packages/carousel_slider
add the below dependency in pubsec.yaml
carousel_slider: ^2.3.1
and see the given example in link.
use
initialPage: 5,
in carousel_slider parameter to show the initial Image
I cannot seem to get the colorFilter prop working with my .json file.
There are no errors but the colours are clearly not changing.
<LottieView
style={{
width: 90,
height: 90,
}}
colorFilters={
[
{
keypath: "asdf",
color: "#abcdef",
}
]
}
source={badge.icon}
loop={false}
/>
I'm importing the .json from After Effects using BodyMovin
but am I changing the layer name correctly? If not why on earth is this not working?
I can't get colorFilters to work but you can try doing the following:
import myAnimation from "./../img/myAnimation.json";
in the render part use LottieView with the import and not with the require inline
<LottieView
//source={require("./../img/radius.json")}
source={myAnimation}
/>
Now you can manipulate the properties directly from the json object, just for example here I manipulate the color based on the actual color (from black to white or from white to black)
myAnimation.layers[1].shapes[0].it[1].c.k = myAnimation.layers[1].shapes[0].it[1].c.k[0] == 0 ? [1,1,1,1] : [0,0,0,1];
To find out what is the property you need, check the json, it is not very clear but with some trial and error you can understand the structure.
Just try with react native, and it's work fine for me
<LottieView
style={style.heartLootie}
source={require("../../assets/animations/favorite_animation.json")}
progress={animationProgress}
colorFilters={[
{ keypath: "Red Heart", color: themeColors.PRIMARY },
{ keypath: "Grey Heart", color: themeColors.SECONDARY },
]}
/>
This is an outstanding issue, I have opened an issue here and will work with the devs to hopefully resolve this issue. It is probably the biggest bottleneck for React Native adoption right now.
I am trying to generate QR code, by using this module 'react-native-qrcode', Here I got generated QR code like this, How can I save this QR code.
Can anyone give me suggestions that how to save this generated qr,any help much appreciated
The library you use uses a webview, therefore you have no image you may save. To save the QR code in a conceptional fashion you may store the value provided and put it into the component as you would like to display it. If you need to get the image, you would need to extend the webview javascript part to use the ImageData interface of the canvas. This is IMHO quite tricky and I am not entirely sure if it is even possible to get data back from the web view.
Use rn-qr-generator to generate a QR code. It will return a path or base64 of generated Image. Later you can use CameraRoll module to store the image in CameraRoll (or Gallery on android).
import RNQRGenerator from 'rn-qr-generator';
import CameraRoll from "#react-native-community/cameraroll";
RNQRGenerator.generate({
value: 'your_qr_string_value_here',
height: 100, // height of the output image
width: 100, // width of the output image
base64: false, // default 'false'
backgroundColor: 'black', // default 'white'
color: 'white', // default 'black'
})
.then(response => {
const { uri, width, height, base64 } = response;
this.setState({ imageUri: uri });
CameraRoll.save(uri);
})
.catch(error => console.log('Cannot create QR code', error));
Before calling CameraRoll.save make sure you have permission to save the image. Permission example see here.