Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

const basePath = process.env.GH_PAGES ? '/segmented/' : '/';
const publicPath = process.env.GH_PAGES ? '/segmented/' : '/';

export default defineConfig({
title: 'rc-segmented',
favicon: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
outputPath: '.doc',
exportStatic: {},
base: '/',
publicPath: '/',
base: basePath,
publicPath,
hash: true,
styles: [
`
Expand Down
6 changes: 0 additions & 6 deletions docs/examples/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ export default function App() {
onChange={(e) => console.log(e.target.value, typeof e.target.value)}
/>
</div>
<div className="wrapper">
<Segmented
options={['iOS', 'Android', null, undefined, '', 'Web']}
onChange={(e) => console.log(e.target.value, typeof e.target.value)}
/>
</div>
<div className="wrapper">
<Segmented
options={[13333333333, 157110000, 12110086]}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"compile": "father build && lessc assets/index.less assets/index.css",
"gh-pages": "npm run docs:build && father doc deploy",
"gh-pages": "GH_PAGES=1 npm run docs:build && father doc deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
setSelected(value);

if (onChange) {
const mutationTarget = Object.create(event.target, {
const mutatedTarget = Object.create(event.target, {
value: {
value,
},
});
const mutatedEvent = Object.create(event, {
target: {
value: mutationTarget,
value: mutatedTarget,
},
});
onChange(mutatedEvent);
Expand Down