Comments (13)
Hey @Angelk90,
Thanks for letting us know! We'll be looking into this and help you shortly :)
from react-native-face-pile.
@peterpme: Were you able to solve the problem?
from react-native-face-pile.
Hey sorry for the delay, really busy releasing www.orchard.ai :)
I think it looks the way it should, but I might have to update the image in the README. Sorry for any confusion.
If you would like to add edge color, text color, background color, I'd be more than happy to accept a PR from you :)
Thanks!
from react-native-face-pile.
@peterpme:
What does it mean: "I think it looks the way it should"?
If you had seen the link on:
https://snack.expo.io/rktD6m9kG
Or
https://snack.expo.io/ryzJpxPMG
I understood that it does not look like it should.
I also report an image of how it looks:
The result of what it should look like is very different:
from react-native-face-pile.
Ohhh, weird! That doesn't happen to me. One sec
from react-native-face-pile.
@peterpme : I also tried the version: v1.7.1, same exact situation:
https://snack.expo.io/HJ8O1bvzz
You can try it directly at: https://snack.expo.io/
Just put your module.
from react-native-face-pile.
Hey @Angelk90,
You are absolutely right. This is broken on Android.
Unfortunately, I have no idea how to fix it. Would you? I'd be happy to accept a PR. I just spent an hour trying to mess around with the numbers with no luck.
Thanks again for reaching out and proving to me that its wrong. Sorry I should have believed you from the beginning, I have just been stressed out 😅
from react-native-face-pile.
@peterpme :
I do not know how it worked on ios.
However this is a rough version of your module, you can find it on the following link: https://snack.expo.io/H1Ksj-YMM
It seems to work, both on ios and both android.
Code:
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { View, Text, Image, StyleSheet, Animated } from 'react-native'
const styles = StyleSheet.create({
container: {
flexDirection: 'row-reverse',
flexWrap: 'nowrap',
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
//backgroundColor: "#000"
},
circle: {
marginBottom: 20,
marginRight: -31
},
circleImage: {
borderWidth: 2,
borderColor: 'white'
},
overflow: {
backgroundColor: '#b6c0ca',
justifyContent: 'center',
alignItems: 'center',
marginLeft: 18
},
overflowLabel: {
color: '#fff',
fontSize: 14,
letterSpacing: -1,
marginLeft: 3,
fontWeight: 'bold'
}
})
class Circle extends PureComponent {
state = {
fadeAnim: new Animated.Value(0)
}
componentDidMount () {
/*
const { delay } = this.props
Animated.timing(this.state.fadeAnim, {
toValue: 1,
duration: 600,
delay
}).start()*/
}
render () {
//const { fadeAnim } = this.state
const { imageStyle, circleSize, face } = this.props
//const borderRadius = circleSize / 2
const innerCircleSize = circleSize * 2
/*
let marginRight = 0
if (overlap >= 0 && overlap <= 1) {
marginRight = circleSize - (circleSize * 2 * overlap)
}*/
return (
<Animated.View
style={[
styles.circle,
{
//width: circleSize,//innerCircleSize
//height: circleSize,//innerCircleSize
//borderRadius: borderRadius,
//opacity: 0.5,
//marginRight: marginRight*-1
},
//circleStyle
]}
>
<Image
style={[
styles.circleImage,
{
width: innerCircleSize,
height: innerCircleSize,
borderRadius: circleSize
},
imageStyle
]}
source={{ uri: face.imageUrl }}
//resizeMode='contain'
/>
</Animated.View>
)
}
}
export function renderFacePile (faces = [], numFaces) {
const entities = [...faces.reverse()]
if (!entities.length) return {
facesToRender: [],
overflow: 0
}
const facesWithImageUrls = entities.filter(e => e.imageUrl)
if (!facesWithImageUrls.length) return {
facesToRender: [],
overflow: 0
}
const facesToRender = facesWithImageUrls.slice(0, numFaces)
const overflow = entities.length - facesToRender.length
return {
facesToRender,
overflow
}
}
export default class FacePile extends PureComponent {
static propTypes = {
faces: PropTypes.arrayOf(
PropTypes.shape({
imageUrl: PropTypes.string
})
),
circleSize: PropTypes.number,
hideOverflow: PropTypes.bool,
containerStyle: PropTypes.instanceOf(StyleSheet),
circleStyle: PropTypes.instanceOf(StyleSheet),
imageStyle: PropTypes.instanceOf(StyleSheet),
overflowStyle: PropTypes.instanceOf(StyleSheet),
overflowLabelStyle: PropTypes.instanceOf(StyleSheet),
render: PropTypes.func,
numFaces: PropTypes.number,
overlap: PropTypes.number
}
static defaultProps = {
circleSize: 20,
hideOverflow: false,
overlap: 0.5
}
_renderOverflowCircle = overflow => {
const {
circleStyle,
overflowStyle,
overflowLabelStyle,
circleSize
} = this.props
const innerCircleSize = circleSize * 2
return (
<View
style={[
styles.circle,
//{ width: circleSize, height: circleSize },
circleStyle
]}
>
<View
style={[
styles.overflow,
{
width: innerCircleSize,
height: innerCircleSize,
borderRadius: circleSize
},
overflowStyle
]}
>
<Text
style={[
styles.overflowLabel,
{
fontSize: circleSize * 0.7
},
overflowLabelStyle
]}
>
+{overflow}
</Text>
</View>
</View>
)
}
_renderFace = (face, index, arr) => {
const { circleStyle, imageStyle, circleSize, overlap } = this.props
if (face && !face.imageUrl) return null
return (
<Circle
key={face.id || index}
delay={(arr.length - index) * 2}
face={face}
circleStyle={circleStyle}
imageStyle={imageStyle}
circleSize={circleSize}
overlap={overlap}
/>
)
}
render () {
const { render, faces, numFaces, hideOverflow, containerStyle } = this.props
if (render) return render({ faces, numFaces })
const { facesToRender, overflow } = renderFacePile(faces, numFaces)
return (
<View style={[styles.container, containerStyle]}>
{overflow > 0 && !hideOverflow && this._renderOverflowCircle(overflow)}
{Array.isArray(facesToRender) && facesToRender.map(this._renderFace)}
</View>
)
}
}
I had to remove overlap, it did not work, put it static.
In my version, I also removed opacity, for proof.
I would ask you to put a field, with the possibility that the user wants it or not, by default do not have it, my personal idea annoys me a lot.
In the meantime, fix the code and modify it:
I would ask you to add the following characteristics, those given at the beginning of the issues.
It would be possible to add a chance to change:
edge color,
text color +8,
color background +8
By default, the standard ones used by you are fine.
P.Š.
Next time check before closing a question, I do not think anyone opens a question because it wants to waste time.
I've never done a PR, so I do not know how to do it. ;)
from react-native-face-pile.
Thanks so much!! Try 1.8.0
from react-native-face-pile.
@peterpme: I tried the new version, it does not seem to work properly. You need to give a default value to offset. Please update the readme, with several examples.
from react-native-face-pile.
added offset to defaultProps in 1.8.1! My bad!
from react-native-face-pile.
any luck @Angelk90 ?
from react-native-face-pile.
I have to do something like that, but it seems like overlap does not work.
Could you fix it?
Link: https://snack.expo.io/rJFecj4S7
from react-native-face-pile.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-face-pile.