Skip to content

Commit 5ea934a

Browse files
Width not found and bgColor fixed
1 parent f16ff6a commit 5ea934a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wniemiec-component-reactnative/month-picker",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Month selector.",
55
"main": "index.js",
66
"repository": {

src/MonthPicker/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default function MonthPicker({
101101
selected={selectedMonth == index}
102102
bgColor={bgColor}
103103
fgColor={fgColor}
104+
width={MONTH_WIDTH}
104105
/>
105106
))}
106107
</ScrollView>

src/components/Month/index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
* @format
99
*/
1010

11-
import React, { useRef, useLayoutEffect } from 'react';
12-
import { Dimensions, ScrollView, View, Text, TouchableOpacity } from 'react-native';
11+
import React from 'react';
12+
import { View, Text, TouchableOpacity } from 'react-native';
1313
import styles from './styles';
1414

15-
export default function Month({ key, month, onPress, selected, bgColor, fgColor }) {
15+
export default function Month({ month, onPress, selected, bgColor, fgColor, width }) {
1616
return (
1717
<MonthButton
18-
key={key}
1918
onPress={onPress}
2019
selected={selected}
21-
fgColor={bgColor}
20+
bgColor={bgColor}
21+
width={width}
2222
>
2323
<Text style={buildMonthTextStyle(fgColor)}>
2424
{month}
@@ -27,12 +27,11 @@ export default function Month({ key, month, onPress, selected, bgColor, fgColor
2727
);
2828
}
2929

30-
function MonthButton({ children, key, onPress, selected, bgColor }) {
30+
function MonthButton({ children, onPress, selected, bgColor, width }) {
3131
return (
3232
<TouchableOpacity
33-
key={key}
3433
onPress={onPress}
35-
style={buildMonthButtonStyle()}
34+
style={buildMonthButtonStyle(width)}
3635
>
3736
<View style={buildMonthButtonAreaStyle(selected, bgColor)}>
3837
{children}
@@ -41,10 +40,10 @@ function MonthButton({ children, key, onPress, selected, bgColor }) {
4140
);
4241
}
4342

44-
function buildMonthButtonStyle() {
43+
function buildMonthButtonStyle(width) {
4544
return [
4645
styles.monthButton,
47-
{ width: MONTH_WIDTH - 20 }
46+
{ width: width - 20 }
4847
];
4948
}
5049

src/components/Month/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StyleSheet } from 'react-native'
1+
import { StyleSheet } from 'react-native';
22

33
export default StyleSheet.create({
44
monthButton: {

0 commit comments

Comments
 (0)